end day 5

This commit is contained in:
quentin.perret 2022-06-03 18:04:36 +02:00
parent bdcd6ccb61
commit 92ed6e44ab
8 changed files with 12 additions and 18 deletions

View file

@ -3,10 +3,8 @@ CC = gcc
all: all:
# rm powerData.csv # rm powerData.csv
$(CC) b2hd.c -o b2hd $(CC) b2hd.c -o b2hd
$(CC) fileGestion.c getArray.c -o getArray $(CC) fileGestion.c getArray.c power.c -lm -o power
# $(CC) fileGestion.c getArray.c power.c -lm -o power
# getArray.c fileGestion.c power.c main.c -o main # getArray.c fileGestion.c power.c main.c -o main
./b2hd < ../02400031.TXT > rawData.csv ./b2hd < ../02400001.TXT > rawData.csv
./getArray ./power
#./power

Binary file not shown.

View file

@ -11,7 +11,7 @@ void b2hd()
quartet value; quartet value;
while (fread(&buff, 26, 1, stdin)) { while (fread(&buff, 26, 1, stdin)) {
fprintf(stdout , "%ld,", millis()); fprintf(stdout , "%d,", millis());
for (int i = 1; i < 9; i++){ for (int i = 1; i < 9; i++){
/*buff[25] = '\0';*/ /*buff[25] = '\0';*/
if (strncmp(buff, "#################\n", (size_t)18) == 0) { if (strncmp(buff, "#################\n", (size_t)18) == 0) {

Binary file not shown.

View file

@ -24,13 +24,16 @@ void fillRawData(long** p, int N, int M) {
FILE *f = fopen("rawData.csv","r"); FILE *f = fopen("rawData.csv","r");
for(i = 0 ; i < N ; i++){ for(i = 0 ; i < N ; i++){
if (!getline(&buffer, &bufsize, f)) break; // condition d'arret de la boucle si fichier fini if (!getline(&buffer, &bufsize, f)) break; // condition d'arret de la boucle si fichier fini
printf("%s",buffer); //printf("buffer : %s token : ",buffer);
j = 0; j = 0;
while((token = strsep(&buffer,",")) != NULL){ // séparation valeur par virgule initiale : csv while((token = strsep(&buffer,",")) != NULL){ // séparation valeur par virgule initiale : csv
//printf("%s ," , token); //printf(token);
p[i][j] = atoi(token); p[i][j] = atoi(token);
//printf("%d,", p[i][j]);
//printf("%d, " , p[i][j]);
j++; j++;
} }
//printf("\n\n");
/* /*
for(j = 1 ; j < M ; j++){ for(j = 1 ; j < M ; j++){
@ -46,7 +49,7 @@ void fillRawData(long** p, int N, int M) {
void printArrayData(long** p, int N, int M) { void printArrayData(long** p, int N, int M) {
int i, j; int i, j;
for(i = 0 ; i < N ; i++){ for(i = 0 ; i < N ; i++){
printf("line n°%d : %d , %d , %d , %d , %d , %d , %d , %d \n" ,i,p[i][0],p[i][1],p[i][2],p[i][3],p[i][4],p[i][5],p[i][6],p[i][7]); printf("line n°%d : %d , %d , %d , %d , %d , %d , %d , %d , %d\n" ,i,p[i][0],p[i][1],p[i][2],p[i][3],p[i][4],p[i][5],p[i][6],p[i][7],p[i][8]);
} }
} }
@ -62,10 +65,4 @@ long **getRawDataArray(int N , int M){
p = get(N, M); p = get(N, M);
fillRawData(p ,N, M); fillRawData(p ,N, M);
return p; return p;
}
void main(int argc , char argv[]){
long **p;
p = getRawDataArray(10,9);
printArrayData(p,10,9);
} }

Binary file not shown.

View file

@ -25,8 +25,7 @@ void power(long **p, double a[]){
} }
} }
int main(int argc , char** argv){ int main(int argc , char** argv){
printf("Get raw data mat"); long **p = getRawDataArray(nRow, nCol);
int32_t **p = getRawDataArray(nRow, nCol);
//printArray(p,nRow,nCol); //printArray(p,nRow,nCol);
double pw[8]; double pw[8];
power(p,pw); power(p,pw);

View file

@ -1,3 +1,3 @@
#include <math.h> #include <math.h>
void power(int **p, double a[]); void power(long **p, double a[]);