int readbuffer() //子程序开始 {
int j=0;
char ch;
//声明变量
while(j<256)
{
ch=fgetc(fp);
if (ch=='\n')
{
i=j;
return 0;
} //if
buffer[j]=ch;
++j;
}
return 1;
} //子程序结束
main() //main()开始
{
if((fp=fopen("d:\\a.c","r"))==NULL) {
printf("THE FILE DOESN’T OPEN!"); exit(0);
}
while(!feof(fp))
{
int j;
j=0;
readbuffer();
while(j<i)
{
printf("%c",buffer[j]);
j++;
}
printf("\n");
getch();
}
fclose(fp);
getch();
} //main()结束
//程序结束
2)当源文件为: