Re: writing large file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hajek,

The problem is of the File System rather than with your program. Im not good at C++, but looking at the error SIGXFS2, I feel, its the limit thats set on your machine as the file-size-limit. Try checking to increase your file-size-limit. By the way, gdb might confirm my answer (it says something like "File size limit exceeded").

Regards,
Harsha.

Hajek, Janus wrote:

Hello,

I'm not sure where to send this question, so I apologize if this is not the
right place.

I'd like to work with files that are larger than 2GB.

This is my sample program :

#include <iostream>
#include <fstream>

using namespace std;

typedef long long int filePos;

int main (int argc, char **argv){

   filePos vel=0;
   cout.precision(10);

   fstream
soubor("testFileSizeSoubor.jh",ios::in|ios::out|ios::binary|ios::trunc);

#define BUFSIZE 1024*1024*128
#define COUNT 8*3

   char* buffer=new char[BUFSIZE];
   if(buffer==0) throw std::bad_alloc();

   for(int i=0;i<COUNT;i++){
       soubor.write(buffer,BUFSIZE);
       vel=soubor.tellp().get_fpos_t();
       cout << (double) vel << endl;
   }

   delete[] buffer;
   soubor.close();

   return 0;
}

When the file size grows above 2GB I'm getting SIGXFS2 on file size limit.
Is it a problem of OS or libstdc++ or my code?

Thank you
Best regards Janus Hajek





--
*****************************
* Sriharsha Vedurmudi
* Software Engineer
* * Redpine Signals Inc.
* Gate #395, Plot 87,88
* Sagar Society, Road #2, * Banjara Hills,
* Hyderabad - 500 034
* www.redpinesignals.com
*
* +91-40-23559911 (Office)
* +91-9849133133 (Mobile)
*****************************



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux