c语言问题,求高手。我用的是VC6.0,下面的代码怎么不能运行。

#include"common1.h"voidmain(){FILE*fp=NULL;structstudentTmpS;charDataFile[40]="";intc... #include "common1.h"
void main()
{
FILE *fp = NULL;
struct student TmpS;
char DataFile[40] = "";
int count = 1; /*Circular variable is to control maximum of input data.*/

/*====input number ,name and grade of english.number is 0 means input is end=====*/
printf("\nplease input the file name to store data,end with enter.");
printf("\n(Notice:Name of file can't exceed 8 characters,\nsuffix can't exceed 3 characters,\npart of exceed will be discarded.)\n");
scanf("%s",DataFile);

while(DataFile[0] == ('\0'))
{
printf("\nplease input new file name to store data,end with enter.");
printf("\n(Notice:Name of file can't exceed 8 characters,\nsuffix can't exceed 3 characters,\npart of exceed will be discarded.)\n");
scanf("%s",DataFile);
}

fp = fopen(DataFile,"wb+");
if (fp == NULL)
{
printf("\n Open file %s fail!End with any key.\n",DataFile);
exit(1);
}

printf("Please input student infomation.\n0 means end.\n");
printf("(Notice:Number is not exceed 9 figures;Name is not exceed 20 characters;Range of grade:0~100)\n");
while(count <= SIZE) /* It's to control recorders less then maximum of stated input data. */
{
printf("Student number:");
scanf("%ld",&TmpS.number);
if (TmpS.number == 0 )
break;

printf("Student name:");
scanf("%s",TmpS.name);

printf("englishscore:");
scanf("%d",&TmpS.score);

printf("\n");
if(fwrite(&TmpS,sizeof(LENGTH),1,fp)!=1)
{
printf("\nwrite file %s fail!End with any key\n",DataFile);
getch();
exit(1);
}
count++;
}
if (count>SIZE)
printf("\nsorry,number of data can not exceed %d\n",SIZE);
fclose(fp);

/*====Showing content of file on screen.====*/
printf("The data has stored successfully in file %s.\n",DataFile);
printf("Content as follow:\n");

fp=fopen(DataFile,"rb");
if (fp == NULL)
{
printf("\nOpen file%sfail!End with any key \n",DataFile);
exit(1);
}

printf("\n Number\tName\tEnglishscore\n");
while(fread(&TmpS,sizeof(LENGTH),1,fp) != (int)NULL)
{
printf("\n%9ld\t%s\t%8d\n",TmpS.number,TmpS.name,TmpS.score);
}
fclose(fp);
getch();
展开
 我来答
圣诞鲨鱼
2011-08-31 · TA获得超过480个赞
知道小有建树答主
回答量:525
采纳率:0%
帮助的人:482万
展开全部
要在最上面加上
#include "stdafx.h"
否则是不能编译通过的
学而时习之okay
2011-08-31 · 超过28用户采纳过TA的回答
知道答主
回答量:358
采纳率:0%
帮助的人:98.7万
展开全部
斌不是想不帮你,没拿那能力
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
小飞花儿的忧伤
2011-08-31 · TA获得超过1661个赞
知道小有建树答主
回答量:1152
采纳率:100%
帮助的人:328万
展开全部
commom1.h没给出来
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
米小柔爱画画
2011-08-31 · 超过23用户采纳过TA的回答
知道答主
回答量:123
采纳率:100%
帮助的人:21.9万
展开全部
错误提示呢
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式