2010-12-10 09:16:09     max filesize clipped to 2GB (using std::fstream)

Document created by Aaronwu Employee on Oct 16, 2013
Version 1Show Document
  • View in full screen mode

2010-12-10 09:16:09     max filesize clipped to 2GB (using std::fstream)

Simon Gustafsson (SWEDEN)

Message: 96630   

 

Hi

 

We are using the 2008R1-RC8 toolchain, and we would like to save larger files using fstreams if possible. This toolchain should have been buildt with LFS (large file support) by default, but it seems like that won't increase the size accessible with iostreams.

 

std::cout << "max stream size = " << std::numeric_limits<std::streamsize>::max();

 

/* That  gives 2GB when compiled, regardless if we supply -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE or not. */

 

As far as I could see, std::streamsize ifs a typedef  to long int (which are 32 bits), and I didn't see any flag that would change that behaviour.

 

Have I missed something, would upgrading to a new release help, or would I need to limit my files to 2GB (quite inconvenient in this application).

 

Regards

Simon Gustafsson

QuoteReplyEditDelete

 

 

2010-12-10 09:47:51     Re: max filesize clipped to 2GB (using std::fstream)

Mike Frysinger (UNITED STATES)

Message: 96631   

 

i have no idea about LFS support at the C++ level.  if you use the standard C functions, everything should work just fine.  open/read/write/etc... or fopen/fread/fwrite/etc...

QuoteReplyEditDelete

 

 

2010-12-10 13:43:56     Re: max filesize clipped to 2GB (using std::fstream)

Mike Frysinger (UNITED STATES)

Message: 96635   

 

playing with it on my desktop, you get the same behavior with glibc.  so i'm not sure the output you're seeing is wrong or implies you wont be able to write to files bigger than 2GiB on the Blackfin system.

QuoteReplyEditDelete

Attachments

    Outcomes