From dd35c14a17bc526ec4844c85365c9e1ce710cc12 Mon Sep 17 00:00:00 2001 From: macbook-pro <3101158440@qq.com> Date: Thu, 21 Dec 2023 11:56:09 +0800 Subject: [PATCH] use ggg --- client/func/readtext.c | 52 ++++++++++++++++++++++++++++++++++++++ client/func/trans_client.c | 19 ++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 client/func/readtext.c 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