[wx-dev] Problem in reading a file
Shriram Bhat
shriramnb at gmail.com
Wed Apr 23 22:54:58 PDT 2008
Hi List,
What is the problem in the following code?
I am trying to write a string to a file and read it back.
When i read, along with characters written, i am getting some other
unreadable characters also.
Can anyone please help me in figuring out where i am doing wrong?
I want to write few strings in a file with each line of file having a
string. And read it back.
wxFile m_File;
wxTextCtrl *WxEdit2;
wxString m_csInifile =3D wxT("C:/FileIO/TestOutput/T1.dat");
if(wxFile::Exists(m_csInifile) =3D=3D false)
m_File.Create(m_csInifile);
if(!m_File.Open(m_csInifile, wxFile::read_write))
{
wxMessageBox("File Error");
}
wxString inStr =3D wxT("Test");
m_File.Write(inStr);
const char *buf =3D new char[8] ;
m_File.Read((void *)buf,4);
WxEdit2->SetValue((const char*)buf);
Thanks,
Shriram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-dev/attachments/20080423/22440=
bc2/attachment-0001.htm
More information about the wx-dev
mailing list