我编了程序编译成功但是显示不出我输入的字符,为什么?请知道的好心告诉我
#include<stdio.h>
struct stu
{
int round[3];
int press[3];
float angle[3];
};
struct beng{
char type[12];
int num[4];
struct stu state;
}data[12],*pp,*qq;
main()
{
FILE *fp;
char ch;
int i;
pp=data;
if((fp=fopen("c:\\WIN-TC\\projects\\stu_list.txt","wb+"))==NULL)
{
printf("Cannot open file strike any key exit!");
getch();
exit(1);
}
printf("\ninput data\n");
for(i=0;i<2;i++,pp++)
{ scanf("%s",pp->type);
fwrite(pp,sizeof(struct beng),2,fp); }
fclose(fp);
if((fp=fopen("c:\\WIN-TC\\projects\\stu_list.txt","rb"))==NULL)
{
printf("Cannot open file strike any key exit!");
getch();
exit(1);
}
ch=fgetchar();
printf("%s",ch);
fclose(fp); getch();
}
[此贴子已经被作者于2007-7-14 14:14:26编辑过]