By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,515 Members | 1,848 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,515 IT Pros & Developers. It's quick & easy.

Problem with ifstream::getline

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.