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

64bit for fwrite ...


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);

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.

zizi21Author Commented:
thanks a million..
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.

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