Search found 55 matches

by dqf88
Wed Aug 10, 2016 12:33 pm
Forum: Announcements and Discoveries
Topic: ANN: wxSQLite3 3.3.1 released
Replies: 5
Views: 2515

Re: ANN: wxSQLite3 3.3.1 released

-------------- Build: DLL Release Win64 x64 in wxsqlite3 (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNDEBUG -D_USRDLL -DWXMAKINGDLL_WXSQLITE3 -D_UNICODE -DWXUSINGDLL -D__WXMSW__ -DwxUSE_DYNA...
by dqf88
Thu Aug 04, 2016 1:04 am
Forum: C++ Development
Topic: wxFFile, why can't I get the correct result?
Replies: 12
Views: 3080

Re: wxFFile, why can't I get the correct result?

// reading // appname and vendorname are ignored when using wxFileConfig // the directory for the .INI file must exist and you must have write permission. // The file itself can be missing, then it will be created wxFileConfig *conf = new wxFileConfig(wxT("appname"), wxT("vendorname"), wxT("c:\\myd...
by dqf88
Thu Aug 04, 2016 12:59 am
Forum: C++ Development
Topic: wxFFile, why can't I get the correct result?
Replies: 12
Views: 3080

Re: wxFFile, why can't I get the correct result?

OK, just be aware the code I posted was written in a hurry as an example, so there is even less guarantees than usual that it is bug-free. And now I realized there is at least one bug in the code. One cannot write/read size_t variables (bufLength in the code above) as binary, this is going to break...
by dqf88
Wed Aug 03, 2016 11:23 am
Forum: C++ Development
Topic: wxFFile, why can't I get the correct result?
Replies: 12
Views: 3080

Re: wxFFile, why can't I get the correct result?

If you really need to, I guess you could do that as I demonstrate in the simple app below: #include <wx/wx.h> #include <wx/ffile.h> bool WritewxStringToFFile(wxFFile& file, const wxString& str) { wxCharBuffer buf(str.utf8_str()); const size_t bufLength = buf.length(); if ( file.Write(&bufLength, si...
by dqf88
Wed Aug 03, 2016 8:27 am
Forum: C++ Development
Topic: wxFFile, why can't I get the correct result?
Replies: 12
Views: 3080

Re: wxFFile, why can't I get the correct result?

Why the "LoadWxString" doesn't work? Thanks again bool SaveWxString( wxFFile &fFile, wxString &str ) { long lHelp; if ( ! fFile.IsOpened() ) return false; lHelp = (long)str.Len() + 1L; fFile.Write( &lHelp, sizeof( lHelp ) ); fFile.Write( str.c_str(), lHelp ); return true; } wxString LoadWxString( wx...
by dqf88
Tue Aug 02, 2016 12:24 pm
Forum: C++ Development
Topic: wxFile--How to read wxString from a file?
Replies: 3
Views: 765

Re: wxFile--How to read wxString from a file?

While writing a string to wxFile would be relatively easy, reading them back will be more difficult. If you don't want to use wxFileConfig like i suggested, try wxTextOutputStream / wxTextInputStream. Usage will be more similar to your original non-working code. http://docs.wxwidgets.org/trunk/clas...
by dqf88
Tue Aug 02, 2016 11:17 am
Forum: C++ Development
Topic: wxFile--How to read wxString from a file?
Replies: 3
Views: 765

wxFile--How to read wxString from a file?

How can I read wxString type strings from a file with wxFile ?
The file contains wxString type strings (str1,str2,……)
by dqf88
Mon Aug 01, 2016 2:43 pm
Forum: C++ Development
Topic: wxFFile, why can't I get the correct result?
Replies: 12
Views: 3080

Re: wxFFile, why can't I get the correct result?

fFile.Write( &CustName, sizeof( wxString ) ); You can't save a wxString this way. You just save the datastructure itself, but not the allocated text which lies in a different memory location. I would suggest to use wxFileConfig for this. I need save items with this method. How can I do it this way?...
by dqf88
Mon Aug 01, 2016 11:33 am
Forum: C++ Development
Topic: wxFFile, why can't I get the correct result?
Replies: 12
Views: 3080

wxFFile, why can't I get the correct result?

when I show the CustName's value ( cout<<"TextCtrl2:"<<Cust->CustName<<endl; ), why can't I get the correct result? #include <wx/list.h> #include <wx/ffile.h> #include <wx/listimpl.cpp> #include <iostream> using namespace std; class Customer { public: int CustID=1; wxString CustName=wxString("temple...
by dqf88
Fri Aug 21, 2015 1:06 pm
Forum: wxCode
Topic: the problem of "wxReportDocument" for print preview
Replies: 5
Views: 2947

the problem of "wxReportDocument" for print preview

When using "wxReportDocument" for print preview, the page can not show all the contents, how to solve this problem, please?
Image 3.png
Image 3.png (49.97 KiB) Viewed 2947 times
by dqf88
Wed Jul 01, 2015 10:15 am
Forum: C++ Development
Topic: About the wxFFile
Replies: 6
Views: 963

Re: About the wxFFile

Thanks for your reply first. when I read the content with the following code, the result("vlp5") of the variable "strData " is followed by unreadable codes, why? wxChar szHelp[20]; m_fFile.Read(szHelp,wxStrlen(VLPHEADER)*sizeof(wxChar)); szHelp[wxStrlen(VLPHEADER)*sizeof(wxChar)]=0x00; strData = szH...
by dqf88
Wed Jul 01, 2015 12:50 am
Forum: C++ Development
Topic: About the wxFFile
Replies: 6
Views: 963

Re: About the wxFFile

How to get the bytes of a wxstring type string? thanks
by dqf88
Tue Jun 30, 2015 2:24 am
Forum: C++ Development
Topic: About the wxFFile
Replies: 6
Views: 963

About the wxFFile

when I write a string "vlp5" to a text file using wxFFile, but only "vl" obtained in the file, why? #include <wx/ffile.h> #define VLPHEADER wxT("vlp5") bool boRet; wxFFile m_fFile; boRet = m_fFile.Open( wxT("temp.txt"), "wb" ); if ( boRet ) { m_fFile.Write(VLPHEADER, wxStrlen(VLPHEADER)); } m_fFile....
by dqf88
Tue Jun 30, 2015 2:11 am
Forum: wxWidgets Development (Chinese)
Topic: wxFFile使用的问题
Replies: 0
Views: 2274

wxFFile使用的问题

写入的字符串怎么不完整?有哪位高手指点一下。如:我写入“vlp5”,文本文件中却只能得到“vl”
实例代码如下:

Code: Select all

	#include <wx/ffile.h>
	#define VLPHEADER wxT("vlp5")
	bool    boRet;
	wxFFile m_fFile;

	boRet = m_fFile.Open( wxT("temp.txt"), "wb" );
	if ( boRet )
	{
		m_fFile.Write(VLPHEADER, wxStrlen(VLPHEADER));
	}
	m_fFile.Close();