Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with ifstream::getline

tinks
Guest
 
Posts: n/a
#1: Nov 8 '05
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.


BobR
Guest
 
Posts: n/a
#2: Nov 9 '05

re: Problem with ifstream::getline



tinks wrote in message
<1131493173.763543.259210@z14g2000cwz.googlegroups .com>...[color=blue]
>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.[/color]

?
'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


Closed Thread