Skip to content
Snippets Groups Projects
Commit 43572dc1 authored by chafiol's avatar chafiol
Browse files

WIP: realloc tab

parent 83e5e1e1
No related merge requests found
...@@ -25,7 +25,8 @@ int readToTab(long* tab, char* file){ ...@@ -25,7 +25,8 @@ int readToTab(long* tab, char* file){
else if(temp == ' '){ else if(temp == ' '){
long t = atol(tmp); long t = atol(tmp);
tab[j] = t; tab[j] = t;
printf("char:%c long:%d n:%d j:%d nb_size:%d, size:%d\n",temp,tab[j], n,j,nb_size, sizet); //printf("char:%c long:%d n:%d j:%d nb_size:%d, size:%d\n",temp,tab[j], n,j,nb_size, sizet);
printf("%s\n", tmp);
memset(tmp, 0, sizet*nb_size); memset(tmp, 0, sizet*nb_size);
j++; j++;
count++; count++;
...@@ -37,7 +38,7 @@ int readToTab(long* tab, char* file){ ...@@ -37,7 +38,7 @@ int readToTab(long* tab, char* file){
read(fd,&temp,sizeof(char)); read(fd,&temp,sizeof(char));
if(n==sizet*nb_size){ if(n==sizet*nb_size){
nb_size+=1; nb_size+=1;
printf("size:%d nb_size:%d, sizef:%d\n", sizet, nb_size, sizeof(char)*(sizet*nb_size)); //printf("size:%d nb_size:%d, sizef:%d\n", sizet, nb_size, sizeof(char)*(sizet*nb_size));
tmp = realloc(tmp, sizeof(char)*(sizet*nb_size)); tmp = realloc(tmp, sizeof(char)*(sizet*nb_size));
} }
} }
......
No preview for this file type
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