//----------------------------
#include <stdio.h>
#include <stdlib.h>
int main () {
char str1[10], str2[10], str3[10];
int year;
FILE * fp;
fp = fopen ("file.txt", "w+");
fputs("We are in 2012", fp);
rewind(fp);
fscanf(fp, "%s %s %s %d", str1, str2, str3, &year);
printf("Read String1 |%s|/n", str1 );
printf("Read String2 |%s|/n", str2 );
printf("Read String3 |%s|/n", str3 );
printf("Read Integer |%d|/n", year );
fclose(fp);
return(0);
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265227.html