DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   file unable to open (http://www.daniweb.com/forums/thread740.html)

sai365 Jul 28th, 2003 2:37 pm
file unable to open
 
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;
}
//****************************************************


All times are GMT -4. The time now is 12:05 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC