|
-
June 26th, 2002, 03:27 PM
#1
Reading data from file
Hi Gurus,
I have this problem. I am reading data from a file, simple text lines. The program works fine on windows, however, on unix, it reads the last line twice ... I am perplexed.
Here's the code:
Code:
while(!(dataFile.eof() || dataFile.bad() || dataFile.fail()))
{
char buffer[HPGL_TOOL_MAX_LINE_LENGTH+1];
dataFile.getline(buffer, HPGL_TOOL_MAX_LINE_LENGTH);
cout << "buffer = " << buffer << endl;
// Add to the part list
partNameList.push_back(buffer);
}
The output (on unix) is:
buffer = /if/21174/2117400-1.prt
buffer = /if/21378/2137813-0.prt
buffer = /if/21378/2137813-0.prt
The data file is:
/if/21174/2117400-1.prt
/if/21378/2137813-0.prt
Please help!
Kamran
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|