FREAD / FWRITE [英] fread/fwrite

查看:85
本文介绍了FREAD / FWRITE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用fread / fwrite复制文件。

当达到文件结束时,fread返回0,我不知道多少字节

在buf。

解决方案

empriser写道:


如何使用fread / fwrite复制一个文件。

当达到文件结束时,fread返回0,我不知道在buf中有多少字节




无。


你有没有这些功能的文件?还是手册?或者

访问谷歌?


-

伸出隐藏在网络中的镜像。 - 文艺复兴,/奔跑/

Hewlett-Packard Limited注册号:

注册办事处:Cain Road,Bracknell,Berks RG12 1HN 690597 England


2007年5月17日00:52:29 -0700,empriser< xu ******** @ gmail.comwrote:
< blockquote class =post_quotes>
>如何使用fread / fwrite复制文件。
当达到文件结束时,fread返回0,我不知道多少字节
在buf。



这取决于fread的编码方式。如果指定1块n

个字符并且文件中剩下少于n个,那么它将返回0。但是,如果指定n个块为1每个字符,然后

它将返回读取的块数(这将是与读取的字符数相同的

)。

删除电子邮件的del


5月17日晚上8:25,Barry Schwarz< schwa ... @ doezl.netwrote:


2007年5月17日00:52:29 -0700,empriser< xueyunl ... @ gmail.comwrote:


如何使用fread / fwrite复制文件。

当达到文件结束时,fread返回0,我不知道在buf中有多少字节




这取决于fread的编码方式。如果指定1块n

个字符并且文件中剩下少于n个,那么它将返回0。但是,如果指定n个块为1每个字符,然后

它将返回读取的块数(这将是与读取的字符数相同的

)。

删除del电子邮件



是我的缓冲区大小是n(n 1)。

我怎么知道有缓冲区中有多少字节,在最后一次调用之后

fread就像返回0一样。


How to use fread/fwrite copy a file.
When reach file''s end, fread return 0, I don''t konw how many bytes
in buf.

解决方案

empriser wrote:

How to use fread/fwrite copy a file.
When reach file''s end, fread return 0, I don''t konw how many bytes
in buf.

None.

Don''t you have documentation for these functions? Or man pages? Or
access to Google?

--
"Reaching out for mirrors hidden in the web." - Renaissance, /Running Hard/

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England


On 17 May 2007 00:52:29 -0700, empriser <xu********@gmail.comwrote:

>How to use fread/fwrite copy a file.
When reach file''s end, fread return 0, I don''t konw how many bytes
in buf.

It depends on how code the fread. If you specify 1 block of n
characters and there is less than n left in the file, then it will
return 0. However, if you specify n blocks of 1 character each, then
it will return the number of blocks read (which will be exactly the
same as the number of characters read).
Remove del for email


On May 17, 8:25 pm, Barry Schwarz <schwa...@doezl.netwrote:

On 17 May 2007 00:52:29 -0700, empriser <xueyunl...@gmail.comwrote:

How to use fread/fwrite copy a file.
When reach file''s end, fread return 0, I don''t konw how many bytes
in buf.


It depends on how code the fread. If you specify 1 block of n
characters and there is less than n left in the file, then it will
return 0. However, if you specify n blocks of 1 character each, then
it will return the number of blocks read (which will be exactly the
same as the number of characters read).

Remove del for email

Yes my buffer size is n (n 1).
How do I know there are how many bytes in buffer, after last call
fread as if return 0.


这篇关于FREAD / FWRITE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆