#include "fileGestion.h" void clearRawData(int N){ char buffer[256]; FILE *f = fopen("newFile.csv","w+"); FILE *g = fopen("rawData.csv","r"); for(int i = 0; i < N; i++){ fgets(buffer , sizeof buffer , g); //printf("Line contaigns: %s" , buffer); } while(1){ if(!fgets(buffer,sizeof buffer , g)) break; fprintf(f,"%s",buffer); } remove("rawData.csv"); rename("newFile.csv", "rawData.csv"); fclose(f); fclose(g); } void writePowerData(double a[], int N){ FILE *f = fopen("powerData.csv","a+"); for(int i = 0 ; i < N ; i++){ if( i < N-1){ fprintf(f, "%f , ", a[i]); } else { fprintf(f, "%f\n", a[i]); } } fclose(f); } void threadCalcul(){ while(stopFlag == false){ if(rawDataWriteFlag){ pthread_mutex_lock(&mutex); while(power(nRow,nCol,period,timeBandwidth) == false){} pthread_mutex_unlock(&mutex); rawDataWriteFlag = true; delay(10); } } }