Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Problem with ifstream::getline (http://www.velocityreviews.com/forums/t449650-problem-with-ifstream-getline.html)

tinks 11-08-2005 11:39 PM

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.


BobR 11-09-2005 02:09 AM

Re: Problem with ifstream::getline
 

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




All times are GMT. The time now is 11:33 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.