new file gestion+first power calcul program
This commit is contained in:
parent
ed38934146
commit
5f1000c453
|
@ -1,11 +1,12 @@
|
|||
CC = gcc
|
||||
TARGET = data
|
||||
|
||||
all: b2hd.c getArray.c power.c newFileData.c
|
||||
all: b2hd.c getArray.c power.c newFileData.c copyFile.c
|
||||
$(CC) b2hd.c -o b2hd
|
||||
$(CC) getArray.c -o getArray
|
||||
$(CC) power.c -o power
|
||||
$(CC) newFileData.c -o newFileData
|
||||
$(CC) copyFile.c -o copyFile
|
||||
|
||||
clean:
|
||||
rm *.o
|
File diff suppressed because it is too large
Load diff
BIN
C-Script/b2hd
BIN
C-Script/b2hd
Binary file not shown.
BIN
C-Script/copyFile
Executable file
BIN
C-Script/copyFile
Executable file
Binary file not shown.
13
C-Script/copyFile.c
Normal file
13
C-Script/copyFile.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "main.h"
|
||||
|
||||
void copyFile(){
|
||||
char buffer[256];
|
||||
while(1){
|
||||
if(!fgets(buffer , sizeof buffer , stdin)) break;
|
||||
fprintf(stdout, "%s" , buffer);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc , char** argv){
|
||||
copyFile();
|
||||
}
|
Binary file not shown.
|
@ -16,30 +16,14 @@ int getArray(){
|
|||
tab[i][0] = atoi(token);
|
||||
|
||||
for(int j = 1 ; j < nCol ; j++){
|
||||
token = strtok(NULL, ",");
|
||||
if(token == NULL) break;
|
||||
token = strtok(NULL, ","); // séparation valeur par virgule : csv
|
||||
if(token == NULL) break; // condition d'arrêt de la séparartion
|
||||
tab[i][j] = atoi(token); //transtypage char to int
|
||||
fprintf(stdout,token);
|
||||
//printf(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
void newFile(){
|
||||
char buffer[256];
|
||||
for(int i = 0; i < nRow; i++){
|
||||
fgets(buffer , sizeof buffer , stdin);
|
||||
printf("Line : %s\n" , buffer);
|
||||
}
|
||||
while(1){
|
||||
if(!fgets(buffer,sizeof buffer , stdin)) break;
|
||||
fprintf(stdin,"%s\n",buffer);
|
||||
}
|
||||
for(int i = 0; i < nRow; i++){
|
||||
fprintf(stdin,"\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc , char** argv){
|
||||
getArray();
|
||||
newFile();
|
||||
}
|
||||
|
|
|
@ -18,4 +18,4 @@ int64_t millis()
|
|||
return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000;
|
||||
}
|
||||
|
||||
int nRow = 100000;
|
||||
int nRow = 10000;
|
||||
|
|
890011
C-Script/newFile.txt
Normal file
890011
C-Script/newFile.txt
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -4,15 +4,14 @@ void newFile(){
|
|||
char buffer[256];
|
||||
for(int i = 0; i < nRow; i++){
|
||||
fgets(buffer , sizeof buffer , stdin);
|
||||
//printf("Line contaigns: %s" , buffer);
|
||||
}
|
||||
while(1){
|
||||
if(!fgets(buffer,sizeof buffer , stdin)) break;
|
||||
fprintf(stdin,"%s\n",buffer);
|
||||
}
|
||||
for(int i = 0; i < nRow; i++){
|
||||
fprintf(stdin,"\n");
|
||||
printf("%s",buffer);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc , char** argv){
|
||||
newFile();
|
||||
}
|
BIN
C-Script/power
BIN
C-Script/power
Binary file not shown.
|
@ -1,7 +1,21 @@
|
|||
#include "main.h"
|
||||
|
||||
float power(){
|
||||
|
||||
int power(int tab){
|
||||
int freq = 250; //imposé par le capteur Vegetal Signal
|
||||
float periode = 1 / freq;
|
||||
int power[8] = {0,0,0,0,0,0,0,0};
|
||||
for(int i = 0; i < 8; i++){
|
||||
int j = 0;
|
||||
int res = 0;
|
||||
while(1){
|
||||
if(tab[j+1][i]==NULL) break;
|
||||
float aire = ( pow(tab[j][i],2) + pow(tab[j+1][i],2) ) / 2 * periode;
|
||||
res += aire;
|
||||
j++;
|
||||
}
|
||||
power[i] = res;
|
||||
}
|
||||
return power;
|
||||
}
|
||||
|
||||
int main(int argc , char** argv){
|
||||
|
|
890011
C-Script/testNewFile.txt
Normal file
890011
C-Script/testNewFile.txt
Normal file
File diff suppressed because it is too large
Load diff
300000
C-Script/testarray.txt
300000
C-Script/testarray.txt
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,7 @@ link = "test.txt"
|
|||
|
||||
f = open(link , "rb")#ouvertuture du fichier txt traiter
|
||||
taille = 5
|
||||
freq = 250000
|
||||
freq = 250
|
||||
periode = 1 / freq
|
||||
temps = periode * taille
|
||||
resultat = np.zeros(taille)
|
||||
|
|
Loading…
Reference in a new issue