关于fread功能的问题 [英] question about fread function

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

问题描述

嗨〜每一个〜我有一个关于fread功能的问题。如果我有这样的

代码:

(nscrdh和数据被定义为两个dementional数组,并且两者都是

它们存储在相同的二进制文件)


fread(& nscrdh,sizeof(nscrdh),1,in);

fread(& data,sizeof(data) ,1,in);


我怎么知道第二个fread开始的位置?它只是从第一个fread的

结束开始的吗?或者在其他地方?

因为我试图写数据首先,把它们读出来。但是在我读完它后,价值与原来不同。


谢谢〜

Hi~ every one~ I have a queston about fread function. if i have a
code like this:
(nscrdh and data are defined as two dementional arrays and both of
them were stored in the same binary file)

fread(&nscrdh,sizeof(nscrdh),1,in);
fread(&data,sizeof(data),1,in);

How can i know where the second fread start? Is it just start from the
end of the first fread? Or somewhere else?
Because i tried to write "data" first and read them out. But after i
read it out , the value is differet from the original.

Thanks~

推荐答案

在文章< f5 ********************************** @ c65g2000hsa。 googlegroups.com>,

xiao< li ********* @ gmail.comwrote:
In article <f5**********************************@c65g2000hsa. googlegroups.com>,
xiao <li*********@gmail.comwrote:

> Hi 〜每一个〜我有一个关于fread功能的问题。如果我有这样的代码:
(nscrdh和数据定义为两个dementional数组,并且它们都存储在同一个二进制文件中)
>Hi~ every one~ I have a queston about fread function. if i have a
code like this:
(nscrdh and data are defined as two dementional arrays and both of
them were stored in the same binary file)


> fread(& nscrdh,sizeof(nscrdh),1,in);
fread(& data,sizeof(data),1,in);
>fread(&nscrdh,sizeof(nscrdh),1,in);
fread(&data,sizeof(data),1,in);


>我怎么知道第二个fread开始的位置?它只是从第一个恐惧的结束开始的吗?或者别的地方?
>How can i know where the second fread start? Is it just start from the
end of the first fread? Or somewhere else?



是的,第二个会在

第一次完成后的下一个可用字节开始。

- -

没有真诚的艺术家对他的劳动完全满意。

- Walter J. Phillips

Yes, the second would start at the next available byte after the
first had finished.
--
"No sincere artist was ever completely satisfied with his labour."
-- Walter J. Phillips


xiao写道:
xiao wrote:

[...]

(nscrdh和数据被定义为两个dementional数组[...]
[...]
(nscrdh and data are defined as two dementional arrays [...]



C没有二维数组.C'的数组是一维的
,但数组元素本身可以是一个数组,

因此给出了一个二维数组的外观。所以

你不应该把它们称为两个 - 但是两个妄想。


-

Eric Sosman
es *** **@ieee-dot-org.inva 盖子


Eric Sosman写道:
Eric Sosman wrote:

xiao写道:
xiao wrote:

> [...]
(nscrdh和数据定义为两个dementional数组[...]
>[...]
(nscrdh and data are defined as two dementional arrays [...]



C没有两个数组。 C'的数组是一维的
,但数组元素本身就是一个数组,因此给出了二维数组的外观。所以

你不应该把它们称为两个 - 但是两个妄想。


C does not have two-dementional arrays. C''s arrays are
one-dimensional, but an array element can itself be an array,
thus giving the appearance of a two-dimensional array. So
you should not call them two-dementional, but two-delusional.



我认为这个子线程已经过时。 :-)


-

[邮件]:Chuck F(cinefalconer at maineline dot net)

[page]: < http://cbfalconer.home.att.net>

尝试下载部分。

I consider this sub-thread demented. :-)

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


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

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