• C

64bit for fwrite ...

Hi,

if i use off_t on 64 bit machine and enable the LFS, do i need to change the fwrite to sizeof(off_t)

fwrite(&value, sizeof(unsigned int),1,fp);

thanks..
zizi21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

evilrixSenior Software Engineer (Avast)Commented:
>> fwrite(&value, sizeof(unsigned int),1,fp);

I assume value is an unsigned int? If so then no, since you are telling fwrite the size of the type you are writing, which is value and if that's an unsigned int then this is correct.

http://www.cplusplus.com/reference/clibrary/cstdio/fwrite/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zizi21Author Commented:
thanks a million..
0
Infinity08Commented:
The offset into the file (off_t) only refers to the position in the file. It says nothing about the data at that position, nor its size.

You can write whatever data you want (of whatever size you want) at the given offset, and sizeof(off_t) has no play in that.

The only thing that is relevant to you about sizeof(off_t), is that it tells you the maximum offset you can use for a file.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.