• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1183
  • Last Modified:

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..
0
zizi21
Asked:
zizi21
1 Solution
 
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
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now