?? bintro.c
字號(hào):
/*瀏覽投票人簡介*/
BrowseIntro()
{
FILE *fp = NULL; /*定義指向文件的指針*/
candidate TmpS; /*定義進(jìn)行操作時(shí)存放結(jié)構(gòu)體變量的*/
char DataFile[40] = "";
/*====輸入存放候選人簡介信息的文件名====*/
printf("\n please input file name to browse,end with enter.");
printf("\n Notice:Name of file can't exceed 8 characters.suffix can't exceed 3 characters,part of exceed will be discarded.\n");
gets(DataFile);
/*如用戶沒有輸入,則循環(huán)提示用戶輸入*/
while(*DataFile == ('\0'))
{
printf("\n please input new file name to store data,end with enter.");
printf("\n Notice:Name of file can't exceed 8 characters,suffix can't exceed 3 characters.part of exceed will be discarded.\n");
gets(DataFile);
}
printf("Content as follow:\n");
/*打開候選人信息文件*/
fp=fopen(DataFile,"rb");
if (fp == NULL)
{
printf("\nOpen file%sfail!End with any key \n",DataFile);
perror("Open file fail");
getch();
exit(1);
}
/*顯示候選人信息*/
printf("\nNumber\tName\tintro\n");
while(fread(&TmpS,sizeof(candidate),1,fp) != (int)NULL)
{
printf("\n%ld \t%s\t%s\n",TmpS.Number,TmpS.Name,TmpS.intro);
}
fclose(fp);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -