end day 5
This commit is contained in:
parent
bdcd6ccb61
commit
92ed6e44ab
|
@ -3,10 +3,8 @@ CC = gcc
|
|||
all:
|
||||
# rm powerData.csv
|
||||
$(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
|
||||
|
||||
./b2hd < ../02400031.TXT > rawData.csv
|
||||
./getArray
|
||||
#./power
|
||||
./b2hd < ../02400001.TXT > rawData.csv
|
||||
./power
|
BIN
Code-C/b2hd
BIN
Code-C/b2hd
Binary file not shown.
|
@ -11,7 +11,7 @@ void b2hd()
|
|||
quartet value;
|
||||
|
||||
while (fread(&buff, 26, 1, stdin)) {
|
||||
fprintf(stdout , "%ld,", millis());
|
||||
fprintf(stdout , "%d,", millis());
|
||||
for (int i = 1; i < 9; i++){
|
||||
/*buff[25] = '\0';*/
|
||||
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
||||
|
|
BIN
Code-C/getArray
BIN
Code-C/getArray
Binary file not shown.
|
@ -24,13 +24,16 @@ void fillRawData(long** p, int N, int M) {
|
|||
FILE *f = fopen("rawData.csv","r");
|
||||
for(i = 0 ; i < N ; i++){
|
||||
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;
|
||||
while((token = strsep(&buffer,",")) != NULL){ // séparation valeur par virgule initiale : csv
|
||||
//printf("%s ," , token);
|
||||
//printf(token);
|
||||
p[i][j] = atoi(token);
|
||||
//printf("%d,", p[i][j]);
|
||||
//printf("%d, " , p[i][j]);
|
||||
j++;
|
||||
}
|
||||
//printf("\n\n");
|
||||
/*
|
||||
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) {
|
||||
int i, j;
|
||||
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);
|
||||
fillRawData(p ,N, M);
|
||||
return p;
|
||||
}
|
||||
|
||||
void main(int argc , char argv[]){
|
||||
long **p;
|
||||
p = getRawDataArray(10,9);
|
||||
printArrayData(p,10,9);
|
||||
}
|
BIN
Code-C/power
BIN
Code-C/power
Binary file not shown.
|
@ -25,8 +25,7 @@ void power(long **p, double a[]){
|
|||
}
|
||||
}
|
||||
int main(int argc , char** argv){
|
||||
printf("Get raw data mat");
|
||||
int32_t **p = getRawDataArray(nRow, nCol);
|
||||
long **p = getRawDataArray(nRow, nCol);
|
||||
//printArray(p,nRow,nCol);
|
||||
double pw[8];
|
||||
power(p,pw);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#include <math.h>
|
||||
|
||||
void power(int **p, double a[]);
|
||||
void power(long **p, double a[]);
|
Loading…
Reference in a new issue