943,502 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6511
  • C++ RSS
Jul 28th, 2003
0

file unable to open

Expand Post »
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;
}
//****************************************************
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sai365 is offline Offline
1 posts
since Jul 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: set me some home work plz
Next Thread in C++ Forum Timeline: ** Need Help ** in a small C++ problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC