sai365 0 Newbie Poster

I am unable to open a file using the below code in c++. The code used to work before.
I am running this program in unix (sun c++ v4.2 compilers). The file I am reading currently is now > 2GB. I am able to read files < 2GB using this code. Is it because of a limit on the unix server? Please let me know the issue with this.

FYI, I had the same issue with the file size in perl. But I used pipe | to read files > 2GB.

Can somebody please help me resolve this issue.

//*******************************************************
#include <iostream.h> 
#include <fstream.h>
int main()
{
    char buffer[500];
    ifstream inFile("FORDNEW.TXT.processed", ios::in);
    // Check if there was an error opening the file
    if (!inFile)
    {
        cout << "Unable to open the file\n";
        return 1;
    }
    while (inFile >> buffer)
        cout << buffer << endl;
    inFile.close();
    return 0;
}
//****************************************************
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.