Stavo cercando di fare BigSomma ma non riesco a gestire il file, quando alloco la memoria per il buffer non la alloca e va nel path che porta a exit(2);
in locale se passo input.txt funziona, non so bene come funzionino queste cose e infatti il codice della lettura l’ho preso da c++ reference
bool flag[10];
long long somma(FILE *pFile){
long lSize;
char * buffer;
size_t result;
// obtain file size:
fseek (pFile , 0 , SEEK_END);
lSize = ftell (pFile);
rewind (pFile);
// allocate memory to contain the whole file:
buffer = (char*) malloc (sizeof(char)*lSize);
if (buffer == NULL) {fputs ("Memory error",stderr); exit (2);}
// copy the file into the buffer:
result = fread (buffer,1,lSize,pFile);
//if (result != lSize) {fputs ("Reading error",stderr); exit (3);}
}