29 lines
749 B
C
29 lines
749 B
C
#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);
|
|
} |