I have an int64_t value which I'm trying to write to a file.

`fwrite(&page->id,sizeof(page->id),1,tid);

if the value of page->id == 00 00 00 00 00 00 00 03, then the variable is written correctly as 03 00 00 00 00 00 00 00. However, if the value is 00 00 00 00 00 00 00 D6, then the value written to the file is D6 FF FF FF FF FF FF FF.

Can anyone tell me what I'm doin wrong?

Recommended Answers

All 2 Replies

Can you post a super simple test program that exhibits the problem? Just set an int64_t value and write it to file, then post up that program so others can attempt to reproduce the issue.

Also, what compiler and OS? :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.