Unable to open File

I am having an issue with opening 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. This is a production issue. Using unix cat and copy I am able to access file > 2GB.

This is a production issue I am working on.
Your quick help is greatly appreciated. Thank you.

//*******************************************************
#include
#include
int main()
{
char buffer[500];
ifstream inFile("FILE.TXT", ios::in);
// Check if there was an error opening the file
if (!inFile)
{
cout << "Unable to open the file
";
return 1;
}
while (inFile >> buffer)
cout << buffer << endl;
inFile.close();
return 0;
}

Comments

  • : I am having an issue with opening 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. This is a production issue. Using unix cat and copy I am able to access file > 2GB.
    :
    : This is a production issue I am working on.
    : Your quick help is greatly appreciated. Thank you.
    :
    : //*******************************************************
    : #include
    : #include
    : int main()
    : {
    : char buffer[500];
    : ifstream inFile("FILE.TXT", ios::in);
    : // Check if there was an error opening the file
    : if (!inFile)
    : {
    : cout << "Unable to open the file
    ";
    : return 1;
    : }
    : while (inFile >> buffer)
    : cout << buffer << endl;
    : inFile.close();
    : return 0;
    : }
    :
    :

    See my reply in "Advanced c/c++ message board"
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion