Problem with ifstream::getline

T

tinks

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___Hgetline6Mpclc_r1 not
found.

Any help is appreciated.
 
B

BobR

tinks wrote in message
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___Hgetline6Mpclc_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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top