writing large file

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

 



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


[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