[wxMSW, 2.6.2, wxUSE_UNICODE] wxTextInputStream::ReadLine bug ?

qwerty qwerty at ytrewq.qy
Wed Sep 6 06:51:51 PDT 2006


Hello

I'm working on some project that uses wxTextInputStream to read texts 
from zipped text files.
The application uses Unicode (wxUSE_UNICODE set).

Today I saw that function wxTextInputStream::ReadLine cuts off the last 
character from every string.
I've looked into the wxTextInputStream::ReadLine method to find out what 
is going on.
The function looks like this:

wxString wxTextInputStream::ReadLine()
{
     wxString line;

     while ( !m_input.Eof() )
     {
         wxChar c = NextChar();
         if(c == wxEOT)
             break;

         if ( !m_input )
             break;

         if (EatEOL(c))
             break;

         line += c;
     }

     return line;
}

The problem is that when last character is read by the NextChar method, 
the status of m_input changes to wxSTREAM_EOF and the while loop breaks 
before the last character is assigned to the line variable (at the end 
of the while loop).
I gues that moving "line += c" right after if (c == wxEOT) condition 
would fix the problem.
Am I right ?

qwerty






More information about the wx-users mailing list