Page 1 of 1

how use wxSscanf for string include the white spaces

Posted: Fri Jan 27, 2012 12:56 am
by vsfai
Hello,

I was wondering if there was a way to include the white spaces in a string.

wxString xxx = wxT("1 test word");

wxChar *naa = NULL;
int num = 0;

if( na ) delete [] naa;
naa = new wxChar[10];

wxSscanf(xxx, wxT("%d %[^\0]s"),&num, naa);
//i tested also this: %[^ ]s and %[ a-zA-Z0-9+*/_]
wxString yyy(naa);
wxMessageBox(naa);

I need have in naa = "test word"";
However, this doesn't include the 'space' character or any other white
spaces. Is there a way I can include the 'space' character rather than skip
in.

Thanks in advance.

BR, VSfai

Re: how use wxSscanf for string include the white spaces

Posted: Fri Jan 27, 2012 2:00 am
by eranif
vsfai wrote:Hello,

I was wondering if there was a way to include the white spaces in a string.

wxString xxx = wxT("1 test word");

wxChar *naa = NULL;
int num = 0;

if( na ) delete [] naa;
naa = new wxChar[10];

wxSscanf(xxx, wxT("%d %[^\0]s"),&num, naa);
//i tested also this: %[^ ]s and %[ a-zA-Z0-9+*/_]
wxString yyy(naa);
wxMessageBox(naa);

I need have in naa = "test word"";
However, this doesn't include the 'space' character or any other white
spaces. Is there a way I can include the 'space' character rather than skip
in.

Thanks in advance.

BR, VSfai
Please ask wxWidgets related questions in the appropriate forum (i.e. NOT in codelite's forum)

http://forums.wxwidgets.org/

Eran