wxWidgets and string & iostream
Teo Fonrouge
teo at windtelsoft.com
Tue Sep 5 03:18:08 PDT 2006
On Tue, 2006-09-05 at 11:30 +0200, Fibre Optic wrote:
> Teo Fonrouge wrote:
> > 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
> > HTH
>
> After changes you have suggested the effect is still the same :-( I do
> not use wxwidget with UNICODE support. Have you ever tried to mix
> wxString and iostream?
Yes, I used to have lots of cout's to make tracelogs. Now I use the
wxWidgets wxLog* classes, are more powerfull & portable to do program
tracelogs.
Have you tried to use a debug utility to do a trace ?.
Is your cout iostream a valid one ? ( maybe a full or invalid device is
causing the seg fault).
By the way :), what platform & libs versions are you using ?, could be
useful to know your current environment settings.
>
> Regards,
> Fibre Optic
best regards
Teo Fonrouge
More information about the wx-users
mailing list