ctrlfseek和fseek 中的值 0L 这个值的含义z是什么
void modify()
{
int ch1;
FILE *f1;
char c,*word,*sent,fname[20];
printf("Enter the filename to be modified: ");
scanf("%s",fname);
if(searchpath(fname))
{
printf("\n1.Character");
printf("\n2.Word");
printf("\n3.Sentence");
printf("\nEnter U'r choice: ");
scanf("%d",&ch1);
if(ch1==1)
{
f1=fopen(fname,"a+");//use to search the fiel in path variables
fseek(f1, 0L, SEEK_END);
printf("Enter the character and CTRL+Z to exit:\n ");
while((c=getchar())!=EOF)
{
putc(c,f1);
}
}
else if(ch1==2)
{
printf("Enter the word: ");
scanf("%s",word);
f1=fopen(fname,"a+");
fseek(f1, 0L, SEEK_END);
fputs(word,f1);
}
else
{
printf("Enter the sentence and CTRL+Z to exit: ");
f1=fopen(fname,"a+");
fseek(f1, 0L, SEEK_END);
while((c=getchar())!=EOF)
{
putc(c,f1);
}
}
}
else
printf("\nFilename does not exist");
fclose(f1);
}
当我运行代码并调用 printf("Enter the character and CTRL+Z to exit:\n"); while((c=getchar())!=EOF) { putc(c,f1); 当我单击ctrl+z我得到 -> 箭头标记并输入时,我也使用 fflush(stdin); 到达无限循环;它丢失了文件的地址并获取了一些垃圾地址,