FILE *file=fopen("inner.txt","w+");
CString str;
str.Format("4.343\n");fwrite(str,sizeof(char),strlen(str),file);
str.Format("1.34\n");
fwrite(str,sizeof(char),strlen(str),file);
double count;
count=12.3435;str.Format("%lf",count);
fwrite(str,sizeof(char),strlen(str),file);
fclose(file);
CString save,s2,s3;
file=fopen("inner.txt","r");
int i=0; fscanf(file,"%s",save);
fscanf(file,"%s",s2);
TRACE("\n%s",save);
TRACE("\n%s",s2);
fclose(file);
CString str;
str.Format("4.343\n");fwrite(str,sizeof(char),strlen(str),file);
str.Format("1.34\n");
fwrite(str,sizeof(char),strlen(str),file);
double count;
count=12.3435;str.Format("%lf",count);
fwrite(str,sizeof(char),strlen(str),file);
fclose(file);
CString save,s2,s3;
file=fopen("inner.txt","r");
int i=0; fscanf(file,"%s",save);
fscanf(file,"%s",s2);
TRACE("\n%s",save);
TRACE("\n%s",s2);
fclose(file);
这是为什么?
char t[10];
fscanf(file,"%s",save);
strcpy(t,save); fscanf(file,"%s",s2);
TRACE("\n%s",t);
TRACE("\n%s",s2);
int i=0;
CString save,s2;
save=" ";s2=" "; fscanf(file,"%s",save); fscanf(file,"%s",s2);
TRACE("\n%s",save);
TRACE("\n%s",s2);
fclose(file);