早教吧作业答案频道 -->其他-->
究竟错在哪了?#includemain(){\x05FILE*p,*q;\x05inti,c[10]={1,2,3,4,5,6,7,8,9,10};\x05p=fopen("1.c","wb");\x05for(i=0;i=0)\x05{\x05\x05fputc(fgetc(p),q);\x05\x05fseek(p,-2,1);\x05}fclose(p);fclose(q);q=fopen("2.c","rb");\x05rewind(q);\x05for(i=
题目详情
究竟错在哪了?
#include
main()
{
\x05FILE *p,*q;
\x05int i,c[10]={1,2,3,4,5,6,7,8,9,10};
\x05p=fopen("1.c","wb");
\x05for(i=0;i=0)
\x05{
\x05\x05fputc(fgetc(p),q);
\x05\x05fseek(p,-2,1);
\x05}
fclose(p);
fclose(q);
q=fopen("2.c","rb");
\x05rewind(q);
\x05for(i=0;i
#include
main()
{
\x05FILE *p,*q;
\x05int i,c[10]={1,2,3,4,5,6,7,8,9,10};
\x05p=fopen("1.c","wb");
\x05for(i=0;i=0)
\x05{
\x05\x05fputc(fgetc(p),q);
\x05\x05fseek(p,-2,1);
\x05}
fclose(p);
fclose(q);
q=fopen("2.c","rb");
\x05rewind(q);
\x05for(i=0;i
▼优质解答
答案和解析
问题出在
q=fopen("2.c","wb");
fseek(p,0,2);
fseek(p,-1,1);
while(ftell(p)>=0)
这几句.
fseek会把文件结束符清除掉,请看linux man page里面的一句话:
A successful call to the fseek() function clears the end-of-file indicator for
the stream and undoes any effects of the ungetc(3) function on the same stream.
所以你的while会无限循环了.
q=fopen("2.c","wb");
fseek(p,0,2);
fseek(p,-1,1);
while(ftell(p)>=0)
这几句.
fseek会把文件结束符清除掉,请看linux man page里面的一句话:
A successful call to the fseek() function clears the end-of-file indicator for
the stream and undoes any effects of the ungetc(3) function on the same stream.
所以你的while会无限循环了.
看了 究竟错在哪了?#includ...的网友还看了以下:
答案是什么啊42.IsawBobinthelibrarywhenIwastherelastnight 2020-03-30 …
下列反应中,加入的物质能加快反应速率,但不起催化作用的是()A.\x05在过氧化氢中加入二氧化锰B 2020-05-13 …
31.----Can you think of another good idea?----Thi 2020-05-16 …
究竟错在哪了?#includemain(){\x05FILE*p,*q;\x05inti,c[10 2020-06-06 …
在word中,写出以下快捷键组合的意思:Ctrl+A:Ctrl+B:Ctrl+C:Ctrl+U:C 2020-06-25 …
51.Thisisthesecondtimehehisbooks.[A]forgets\x05[B 2020-07-17 …
下列关于顺序文件的描述,错误的是().A、\x05顺序文件可以用字符型变量进行书写B、\x05顺序文 2020-12-14 …
RAS信令支持的功能有A、\x05GK发现B、\x05注册C、\x05接入请求D、\x05带宽请求E 2020-12-31 …
2011四川高考数学(理)倒数第二题中的P异于A,椭圆有两顶点A(-1,0)、B(1,0),过其焦点 2021-01-10 …
6.2分弱场中,八面体和四面体配合物的CFSE相等的是…………………………………()(A)Fe2+\ 2021-01-13 …