new file gestion+first power calcul program
This commit is contained in:
parent
ed38934146
commit
5f1000c453
|
@ -1,11 +1,12 @@
|
||||||
CC = gcc
|
CC = gcc
|
||||||
TARGET = data
|
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) b2hd.c -o b2hd
|
||||||
$(CC) getArray.c -o getArray
|
$(CC) getArray.c -o getArray
|
||||||
$(CC) power.c -o power
|
$(CC) power.c -o power
|
||||||
$(CC) newFileData.c -o newFileData
|
$(CC) newFileData.c -o newFileData
|
||||||
|
$(CC) copyFile.c -o copyFile
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o
|
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);
|
tab[i][0] = atoi(token);
|
||||||
|
|
||||||
for(int j = 1 ; j < nCol ; j++){
|
for(int j = 1 ; j < nCol ; j++){
|
||||||
token = strtok(NULL, ",");
|
token = strtok(NULL, ","); // séparation valeur par virgule : csv
|
||||||
if(token == NULL) break;
|
if(token == NULL) break; // condition d'arrêt de la séparartion
|
||||||
tab[i][j] = atoi(token); //transtypage char to int
|
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){
|
int main(int argc , char** argv){
|
||||||
getArray();
|
getArray();
|
||||||
newFile();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,4 @@ int64_t millis()
|
||||||
return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000;
|
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];
|
char buffer[256];
|
||||||
for(int i = 0; i < nRow; i++){
|
for(int i = 0; i < nRow; i++){
|
||||||
fgets(buffer , sizeof buffer , stdin);
|
fgets(buffer , sizeof buffer , stdin);
|
||||||
|
//printf("Line contaigns: %s" , buffer);
|
||||||
}
|
}
|
||||||
while(1){
|
while(1){
|
||||||
if(!fgets(buffer,sizeof buffer , stdin)) break;
|
if(!fgets(buffer,sizeof buffer , stdin)) break;
|
||||||
fprintf(stdin,"%s\n",buffer);
|
printf("%s",buffer);
|
||||||
}
|
|
||||||
for(int i = 0; i < nRow; i++){
|
|
||||||
fprintf(stdin,"\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc , char** argv){
|
int main(int argc , char** argv){
|
||||||
newFile();
|
newFile();
|
||||||
}
|
}
|
BIN
C-Script/power
BIN
C-Script/power
Binary file not shown.
|
@ -1,7 +1,21 @@
|
||||||
#include "main.h"
|
#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){
|
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
|
f = open(link , "rb")#ouvertuture du fichier txt traiter
|
||||||
taille = 5
|
taille = 5
|
||||||
freq = 250000
|
freq = 250
|
||||||
periode = 1 / freq
|
periode = 1 / freq
|
||||||
temps = periode * taille
|
temps = periode * taille
|
||||||
resultat = np.zeros(taille)
|
resultat = np.zeros(taille)
|
||||||
|
|
Loading…
Reference in a new issue