Groups
Groups
Sign in
Groups
Groups
ahkcn
Conversations
About
Send feedback
Help
[Ubuntu-zh] feof的问题
3 views
Skip to first unread message
吴亚杰
unread,
Mar 16, 2012, 5:24:37 AM
3/16/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ubun...@lists.ubuntu.com
在用feof判断文件是否结束的时候总会多出一行:
下面的代码运行的结果总是 最后一行被读取了两次。
whie(!feof(fp)){
fscanf(fp,“%d”,&data);
}
fp指向的文件中存放如下的内容:
1122334455
运行上面的代码,55总是被读取了两次。这是为什么?feof在判断文件结束时返回非零值,不是应该退出while嘛?
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: <
https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20120316/7e541eec/attachment.html
>
--
ubuntu-zh mailing list
ubun...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
Reply all
Reply to author
Forward
0 new messages