下面程序的运行结果是( )。 #include <stdio.h> main() { FILE *fp; int a=2,b=4,c=6,k,n; fp=fopen("test.dat","w"); fprintf(fp,"%d\n",a); fprintf(fp,"%d %d\n",b,c); fclose(fp); fp=fopen("test.dat","r"); fscanf(fp,"%d%*d%d",&k,&n); printf("%d %d\n",k,n); fclose(fp); }
对下面程序描述错误的是( )。 #include <stdio.h> main() { int c; FILE *fp; if((fp=fopen("file.dat","rb+"))!=NULL) { c=fgetc(fp); c=c+1;} fseek(fp,0,SEEK_SET); fputc(i,fp); fclose(fp); }
若有定义: struct teacher { int num; char name[10]; char sex; int age; }t1={2001,"Li Ming",'M',35};则下列( )对结构变量引用是正确的。