473,327 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Problem with ifstream::getline

I am getting a linking error when I do something like this:

ifstream dataFile;
dataFile.open(dataFileName_, ios::in);
while(dataFile)
{
dataFile.getline(buffer, MAX_DATA_FILE_LINE_LEN); // This line
creates linking issue on solaris
}

The getline call leads to a linking error on sunwspro/6.2 and works
fine on linux.

__1cDstdNbasic_istream4Ccn0ALchar_traits4Cc___Hget line6Mpclc_r1 not
found.

Any help is appreciated.

Nov 8 '05 #1
1 2850

tinks wrote in message
<11**********************@z14g2000cwz.googlegroups .com>...
I am getting a linking error when I do something like this:

ifstream dataFile;
dataFile.open(dataFileName_, ios::in);
while(dataFile)
{
dataFile.getline(buffer, MAX_DATA_FILE_LINE_LEN); // This line
creates linking issue on solaris
}

The getline call leads to a linking error on sunwspro/6.2 and works
fine on linux.

__1cDstdNbasic_istream4Ccn0ALchar_traits4Cc___Hge tline6Mpclc_r1 not
found.
Any help is appreciated.


?
'buffer' is not declared/defined. size==Big_Enough.
MAX_DATA_FILE_LINE_LEN is not declared/defined.
std::basic_istream::getline(char*, int) is not defined.
?

#include <iostream>
#include <ostream>
#include <string>
#include <vector>
#include <fstream>

int main(){
std::vector<std::string> vec1;
std::string buffer;
std::string fName( dataFileName_ );
std::ifstream infile( fName.c_str() );
if( not infile){ return EXIT_FAILURE;}
while( getline( infile, buffer ) ){
vec1.push_back ( buffer );
} // while()
for( size_t a(0); a < vec1.size(); ++a){
std::cout<<vec1.at(a)<<std::endl;
} // for(a)
return 0;
} // main() end

and it looks like some newer implementations may need:
std::getline()
std::size_t

Being a smart-ass is an art, being an idiot is natural! (or was that the
other way around?)<G>
--
Bob R
POVrookie
Nov 9 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ram Laxman | last post by:
Iam new bie to C++ programming.. I want to write a program which will read the Comma separated values(CSV) file column wise. For example: In a.txt: "TicketNumber","Phone","CarNumber"...
15
by: Christopher Benson-Manica | last post by:
The dumb-o-meter's pegging out today... What, if anything, is wrong with the following code? std::ifstream f( "myfile.txt" ); if( !f ) { cerr << "Couldn't open file\n"; } while( getline(f,s)...
3
by: Dmitri Zhukov | last post by:
Hi all, I've found out a difference between stringstream and ifstream objects: stringstream::getline() will include \r (13) character ifstream::getline won't include \r I wonder how come....
14
by: KL | last post by:
I am so lost. I am in a college course for C++, and first off let me state I am not asking for anyone to do my assignment, just clarification on what I seem to not be able to comprehend. I have a...
6
by: Dave | last post by:
In .Net 2003 if a line, read from a text file is larger than a size parameter, the ifstream getline(buff, sze) put the file pointer to the EOF, so next peek() returns EOF. I saw this problem...
2
Schwack
by: Schwack | last post by:
I've just started learning C++ (got bored at work) and I'm using VC++ to compile some simple code but I get a compile error in test.cpp when using "getline". I've searched the internet and this...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.