wxWidgets and string & iostream

Teo Fonrouge teo at windtelsoft.com
Mon Sep 4 08:12:57 PDT 2006


On Mon, 2006-09-04 at 16:03 +0200, Fibre Optic wrote:
> Hello,
> 
> I have just written the following small code which has the following 
> declaration:
> 
> wxString xxxx = "TEST";

Maybe you are using the UNICODE wxWidgets version, anyway you need to
use the following form to properly assign a wxString type var:

wxString xxxx = _T("TEST"); // or wxT("TEST")

> 
> and i am going to print it out on the following way:
> 
> std::cout << "xxxx= " << xxxx << endl;

in this case you need to change the wxString var contents to multibyte C
string:

std::cout << "xxxx= " << xxxx.mb_str() << endl;

> 
> There is not problem with compilation or linking but during execution i 
> se segmentation fault + stac trace... Is it possible to mix wxWidgets 
> classes with i.e. strings/iostream functionality?

AFAIK yes

> 
> Regards,
> Fibre Optic

HTH

best regards

Teo Fonrouge







More information about the wx-users mailing list