#include <wx/file.h>
#include <wx/crt.h>
#include <wx/textfile.h>
int main(int argc,char **argv)
{
wxString str="You make me want to be a better man.\n";
wxFile file;
file.Create("quote",true);
if(file.IsOpened()){
wxPuts("the file is opened.");
}
file.Write(str);
file.Close();
if(!file.IsOpened())
{
wxPuts("the file is opened.");
}
//text file
wxTextFile f("main.cpp");
f.Open();
wxPrintf("Number of lines:%zu\n",f.GetLineCount());
wxPrintf("First line:%s\n",f.GetFirstLine().ToStdWstring());
wxPrintf("Last lins:%s\n",f.GetLastLine().c_str());
wxPuts("begin to read file ");
wxString s;
for(s=f.GetFirstLine();!f.Eof();s=f.GetNextLine())
{
wxPuts(s);
}
f.Close();
wxPuts("end to read file ");
system("pause");
}