paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] Problem with PG_File::getline


From: Andrew Ford
Subject: Re: [paragui-users] Problem with PG_File::getline
Date: Thu, 8 Aug 2002 09:08:50 -0700 (PDT)

Hi Roger,
    What happens at the end of a line when you only
have (presumably) a word and then a newline.  What
does lines.find(' ') do in this case?  Have you tried
outputting the strings themselves to see if the last
letter is indeed cut off?

Andrew

--- "Roger D. Vargas" <address@hidden> wrote:
> Please, take a look at the following piece of code
> and check if there are
> errors. It works fine, but the last line read lost
> the last char. I solved
> the problem adding a space at the end of last line,
> but maybe getline should
> be checked to see if there is a bug.
> 
> 
> while (!splist->eof())  {
>   std::string lines, key, fil;
>       lines=splist->getline();          //Get a line
>       //and parse it
>       linediv=lines.find(' ');          //Find the
> first space
> 
>       key.insert(0,lines.substr(0,linediv));
> 
>      
>
fil.insert(0,lines.substr(linediv+1,lines.length()));
>       tmp=IMG_Load(const_cast<char*>(fil.c_str()));
>       tmp=SDL_DisplayFormat(tmp);
>      
>
cache->AddSurface(const_cast<char*>(key.c_str()),tmp);
> 
>  } //of while
> 
> --
> Roger D. Vargas         | El sistema se apagara en 5
> segundos.
> ICQ: 117641572          | Salvese el que pueda!
> Linux User: 180787      |
> 
> 
> 
> _______________________________________________
> paragui-users mailing list
> address@hidden
>
http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]