diff --git a/client/func/readtext.c b/client/func/readtext.c new file mode 100644 index 0000000..00b0a0e --- /dev/null +++ b/client/func/readtext.c @@ -0,0 +1,52 @@ +void readtext(){ + FILE *f; + int i=0; + int num_text=0; + char a; + int i_text=0; + int acount_text=0; + + //acount the num of char and row + f=fopen(name,"r+"); + a=fgetc(f); + for(;a!=EOF;){ + if(a=='\n'){ + i++; + } + num_text++; + a=fgetc(f); + } + fclose(f); + row_text=i; + + //write the text to [] + text=(char *)malloc(sizeof(char)*(num_text+1)); + ana_text=(int *)malloc(sizeof(int)*(row_text+1)); + + f=fopen(name,"r+"); + a=fgetc(f); + for(i=0;i