paragui-users
[Top][All Lists]
Advanced

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

[paragui-users] Problem with PG_File::getline


From: Roger D. Vargas
Subject: [paragui-users] Problem with PG_File::getline
Date: Thu, 8 Aug 2002 09:32:16 -0400 (CDT)

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      |





reply via email to

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