Commit di recap
This commit is contained in:
1 parent
2f967a0fd8
commit
1c17ccc2c7
14 files changed
+75
-4
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -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:
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||
QyNTUxOQAAACDoGTp2mFxRu8ExX/qqNfnG0OUg147jqrAhjLkX0hKBxwAAAJhqlG87apRv
|
||||
OwAAAAtzc2gtZWQyNTUxOQAAACDoGTp2mFxRu8ExX/qqNfnG0OUg147jqrAhjLkX0hKBxw
|
||||
AAAEC0ZNFQCTPlQrSl0voBkhX5SA6ZjIOTQ1sUiWLOtBhnZugZOnaYXFG7wTFf+qo1+cbQ
|
||||
5SDXjuOqsCGMuRfSEoHHAAAAFHJleGVyZWZAcG9ydGF0aWxlbnpvAQ==
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOgZOnaYXFG7wTFf+qo1+cbQ5SDXjuOqsCGMuRfSEoHH rexeref@portatilenzo
|
||||
+5
-2
@@ -7,10 +7,13 @@
|
||||
#include <ncurses.h>
|
||||
|
||||
struct product {
|
||||
char
|
||||
float cost;
|
||||
int numberSold;
|
||||
char name;
|
||||
};
|
||||
|
||||
int getCount();
|
||||
int exists(const char *fname);
|
||||
int existsFile(const char *fname);
|
||||
void createFile(const char *fname);
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@ BUILD_DIR = build
|
||||
SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
||||
OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES))
|
||||
EXEC = productManager
|
||||
EXECTEST = test
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
@@ -20,6 +21,9 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
test:
|
||||
$(CC) $(CFLAGS) src/logic.c src/testLogic.c -o $(EXECTEST)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR) $(EXEC)
|
||||
|
||||
|
||||
Binary file not shown.
Whitespace-only changes.
Whitespace-only changes.
+40
-2
@@ -6,9 +6,18 @@
|
||||
#include "../include/logic.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;
|
||||
if ((file = fopen(fname, "r")))
|
||||
{
|
||||
@@ -18,7 +27,36 @@ int exists(const char *fname) {
|
||||
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(){
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user