954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

creating files larger than 2GB with FILE or fstream

I am trying to write a large file, but it always stops writing when it hits 2GB. (2147483647 bytes to be exact). I know it's not an O/S or disk issue (I'm on solaris) as I'm able to use the mkfile command to create a 3GB file.

I'm using the SUN workshop compiler. Are you aware of any flags that I can use that will allow writing files that are larger than 2GB?

winbatch
Posting Pro in Training
466 posts since Feb 2005
Reputation Points: 68
Solved Threads: 18
 

I was able to figure it out by doing 'man lfcompile', which told me about 'getconf'. I then ran getconf LFS_CFLAGS and got
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

Once I compiled with these flags, I could create files larger than 2 GB.

winbatch
Posting Pro in Training
466 posts since Feb 2005
Reputation Points: 68
Solved Threads: 18
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You