From: Sergei Steshenko on


--- Zhao Dexiang <zdx(a)eisoo.com> wrote:

> Wrote like this:
>
> ifstream ifs ("C:\\userinfo.dat", std::ios::in);
>
> if(!ifs.is_open())
> {
> return;
> }
>
> // string line;
> while(!ifs.eof())
> {
> char buf[1024] = {0};
> ifs.getline(buf, sizeof(buf));
> wxString cc(buf, wxConvLocal);
> wxMessageBox (cc);
> }
>
> ifs.close();
> ===============================
> Is this that you want?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>
>

You do not have any indication of string longer than 1024 characters
- do you ?

I am not a C++ guru, but I hope wxWidgets and standard C++ string classes
are similar, so why not look this up in a C++ tutorial - maybe the solution
will be very similar.


Applications From Scratch: http://appsfromscratch.berlios.de/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: "Mohd Radzi Ibrahim" on
Hi,

You may want to use wxFileInputStream and wxTextInputStream. For example:

wxFileInputStream fInput(wxT("afile"));
wxTextInputStream tInputStream(fInput);
while (!fInput.Eof()) {
wxString aLine = tInputStream.ReadLine();
}



regards,
Radzi.

----- Original Message -----
From: "He Hongfu" <hhfesle(a)sohu.com>
To: <wx-users(a)lists.wxwidgets.org>
Sent: Thursday, July 13, 2006 9:51 AM
Subject: How to read a line from text file?


> Hi,
>
> I'd like to read string from a text file line by line. But wxFile or
> wxFileInputStream only support read data from file byte by byte. How can
> a read lines from a text file like the following?
>
> while (reader.HasMore ()) {
> wxString line = reader.ReadLine ();
> // do something.
> }
>
> Thanks in advance.
>
> He Hongfu
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: chris elliott on
wxtextFile is your friend -see getfirstline

http://biolpc22.york.ac.uk/wx/docs/html/wx/wx_wxtextfile.html#wxtextfilegetfirstline

chris



He Hongfu wrote:
> Hi,
>
> I'd like to read string from a text file line by line. But wxFile or
> wxFileInputStream only support read data from file byte by byte. How can
> a read lines from a text file like the following?
>
> while (reader.HasMore ()) {
> wxString line = reader.ReadLine ();
> // do something.
> }
>
> Thanks in advance.
>
> He Hongfu
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org