diff --git a/Code-C/main b/Code-C/main index 0f0ab26..c46c7d2 100755 Binary files a/Code-C/main and b/Code-C/main differ diff --git a/Code-C/simulateFlux.c b/Code-C/simulateFlux.c index bf41fb2..5c94eff 100644 --- a/Code-C/simulateFlux.c +++ b/Code-C/simulateFlux.c @@ -35,15 +35,15 @@ char *createNewRawDataFileName(){ char *fileNumber = convertIntegerToChar(cptFile); char fileNameNumber[strlen(fileName)+strlen(fileNumber)]; - char *fullFillName = malloc( (strlen(fileNameNumber)+strlen(extension)) * sizeof(char*) ); + char *fullFileName = malloc( (strlen(fileNameNumber)+strlen(extension)) * sizeof(char*) ); strcpy( fileNameNumber, fileName ); strcat( fileNameNumber, fileNumber ); - strcpy( fullFillName, fileNameNumber ); - strcat( fullFillName, extension ); + strcpy( fullFileName, fileNameNumber ); + strcat( fullFileName, extension ); - return fullFillName; + return fullFileName; } int intInArray(int number , int *array , int N){ @@ -66,7 +66,7 @@ int64_t millis() timespec_get(&now, TIME_UTC); return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000; } -bool writeOneRawData(FILE *rawDataFill){ +bool writeOneRawData(FILE *rawDataFile){ char buff[26]; char buff2[18]; int32_t values[8]; @@ -75,7 +75,7 @@ bool writeOneRawData(FILE *rawDataFill){ if(fread(&buff, 26, 1, stdin)) { - fprintf(rawDataFill , "%d,", millis()); + fprintf(rawDataFile , "%d,", millis()); if (strncmp(buff, "#################\n", (size_t)18) == 0) { if (!(fread(&buff2, 18, 1, stdin))) { fprintf(stderr, "Erreur lecture après ###...#"); @@ -98,10 +98,10 @@ bool writeOneRawData(FILE *rawDataFill){ if(i==maxCApteurNb){ - fprintf(rawDataFill, "%d\n", values[i]/256); + fprintf(rawDataFile, "%d\n", values[i]/256); } else{ - fprintf(rawDataFill, "%d,", values[i]/256); + fprintf(rawDataFile, "%d,", values[i]/256); } } } @@ -115,15 +115,18 @@ bool writeOneRawData(FILE *rawDataFill){ } void *simulateFlux(void *vargp){ - - char *fillName = createNewRawDataFileName(); - FILE *rawDataFill = fopen(fillName,"w+"); - while(writeOneRawData(rawDataFill)){ + char *fileName = createNewRawDataFileName(); + FILE *rawDataFile = fopen(fileName,"w+"); + while(writeOneRawData(rawDataFile)){ if(cptData == nRow){ + fclose(rawDataFile); cptData = 0; cptFile++; - fillName = createNewRawDataFileName(); - FILE *rawDataFill = fopen(fillName,"w+"); + //create struct here + char *fileName = createNewRawDataFileName(); + printf(fileName); + printf("\n"); + FILE *rawDataFile = fopen(fileName,"w+"); } } -} \ No newline at end of file +}