Commit di recap

This commit is contained in:
admin committed 2025-10-31 14:34:27 +01:00
1 parent 2f3ef9736c
commit 7c7859dc90
14 files changed
+75 -4

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
build/testLogic.o: src/testLogic.c src/../include/logic.h \
src/../include/globals.h
src/../include/logic.h:
src/../include/globals.h:
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACDoGTp2mFxRu8ExX/qqNfnG0OUg147jqrAhjLkX0hKBxwAAAJhqlG87apRv
OwAAAAtzc2gtZWQyNTUxOQAAACDoGTp2mFxRu8ExX/qqNfnG0OUg147jqrAhjLkX0hKBxw
AAAEC0ZNFQCTPlQrSl0voBkhX5SA6ZjIOTQ1sUiWLOtBhnZugZOnaYXFG7wTFf+qo1+cbQ
5SDXjuOqsCGMuRfSEoHHAAAAFHJleGVyZWZAcG9ydGF0aWxlbnpvAQ==
-----END OPENSSH PRIVATE KEY-----
+1
View File
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOgZOnaYXFG7wTFf+qo1+cbQ5SDXjuOqsCGMuRfSEoHH rexeref@portatilenzo
+5 -2
View File
@@ -7,10 +7,13 @@
#include <ncurses.h> #include <ncurses.h>
struct product { struct product {
char float cost;
int numberSold;
char name;
}; };
int getCount(); int getCount();
int exists(const char *fname); int existsFile(const char *fname);
void createFile(const char *fname);
#endif #endif
+4
View File
@@ -6,6 +6,7 @@ BUILD_DIR = build
SOURCES = $(wildcard $(SRC_DIR)/*.c) SOURCES = $(wildcard $(SRC_DIR)/*.c)
OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES)) OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES))
EXEC = productManager EXEC = productManager
EXECTEST = test
DEPS = $(OBJECTS:.o=.d) DEPS = $(OBJECTS:.o=.d)
@@ -20,6 +21,9 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
-include $(DEPS) -include $(DEPS)
test:
$(CC) $(CFLAGS) src/logic.c src/testLogic.c -o $(EXECTEST)
clean: clean:
rm -rf $(BUILD_DIR) $(EXEC) rm -rf $(BUILD_DIR) $(EXEC)
BIN
View File
Binary file not shown.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
+40 -2
View File
@@ -6,9 +6,18 @@
#include "../include/logic.h" #include "../include/logic.h"
#include "../include/globals.h" #include "../include/globals.h"
FILE *products; /*
* TODO: Listare prodotti con prezzo da file
* TODO: Aggiungere prodotto con prezzo a file
* TODO: Listare copie vendute di prodotto da file
* TODO: Aggiungere copie venduto di prodotto a file
* TODO: Cambiare nome dei file con interagisce
* TODO: Calcolare la somma delle entrate dati i file
*/
int exists(const char *fname) { char *products;
int existsFile(const char *fname) {
FILE *file; FILE *file;
if ((file = fopen(fname, "r"))) if ((file = fopen(fname, "r")))
{ {
@@ -18,7 +27,36 @@ int exists(const char *fname) {
return 0; return 0;
} }
void createFile(const char *fname) {
FILE *file;
file = fopen(fname, "w");
fclose(file);
}
char* getProducts(const char *fname) {
FILE *file;
if((file=fopen(fname, "r"))==NULL) {
printf("Errore nell'apertura del file");
exit(1);
}
// TODO QUESTO CODICE NON E' MIO, RICONTROLLARE FUNZIONAMENTO fread()
while(!feof(file)){
n = fread(buffer, sizeof(char), sizeof(buffer), file);
for (i=0; i<n; i++)
if (buffer[i] == c)
count++;
}
fclose(file);
}
int getCount(){ int getCount(){
return 0; return 0;
} }
+14
View File
@@ -0,0 +1,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ncurses.h>
#include "../include/logic.h"
#include "../include/globals.h"
int main() {
printf("%d", exists("qwestoeuntest"));
createFile("qwestoeuntest");
printf("%d", exists("qwestoeuntest"));
return 0;
}