Skip to content
Snippets Groups Projects
Commit 91cac966 authored by chafiol's avatar chafiol
Browse files

struct data

parent c7f4694d
No related merge requests found
...@@ -11,6 +11,8 @@ int main(int argc, char **argv){ ...@@ -11,6 +11,8 @@ int main(int argc, char **argv){
long tab[100]; long tab[100];
int n = readToTab(tab, argv[2]); int n = readToTab(tab, argv[2]);
struct data data;
initData(&data);
printf("Base : "); printf("Base : ");
for(int i = 0; i<n; i++){ for(int i = 0; i<n; i++){
printf("%ld,", tab[i]); printf("%ld,", tab[i]);
......
...@@ -30,4 +30,26 @@ int readToTab(long* tab, char* file){ ...@@ -30,4 +30,26 @@ int readToTab(long* tab, char* file){
read(fd,&temp,sizeof(char)); read(fd,&temp,sizeof(char));
} }
return n-1; return n-1;
}
void initData(struct data* d){
d->time = 0;
d->comparison = 0;
d->ct_fusion = 0;
d->ct_parse = 0;
d->write = 0;
}
void generate_tab(long* t, int nb){
int taille_tab = 0;
if(nb == NULL){
taille_tab = (int)(random()+1)%100
}
else{
taille_tab = nb
}
for(int i = 0; taille_tab<taille_tab; i++){
}
} }
\ No newline at end of file
...@@ -7,5 +7,15 @@ ...@@ -7,5 +7,15 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <time.h>
int readToTab(long* tab, char* file); struct data {
\ No newline at end of file time_t time;
unsigned int write;
unsigned int comparison;
unsigned int ct_fusion;
unsigned int ct_parse;
}
int readToTab(long* tab, char* file);
void initData(struct data d*);
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment