Re: ustring to char*
- From: Bob Caryl <bob fis-cal com>
- To: remco cats hccnet nl
- Cc: gtkmm-list gnome org
- Subject: Re: ustring to char*
- Date: Wed, 04 May 2005 11:32:41 -0500
remco cats hccnet nl wrote:
hi all,
i have a question i want to use the data of the Gtkmm::entry.
I know this data is ustring but i want it in char* so my API can use it.
the following code i already tried.
termBox.insertLine(0, "MESG: ", msgEntry.get_text());
string str = ("msg;dftxt;" + msgEntry.get_text().raw());
cout << str;
This works for the terminal but i doesn't work for my API. Is there a way to convert the string to char*.
I also tried:
termBox.insertLine(1, "QSTN: ", msgEntry.get_text());
char* str;
strcpy(str, msgEntry.get_text().c_str());
rfcomm_write(mc3t_bt_dev, str);
It will compile but when i want to use it it wil generate the following error:
Program has been terminated receiving signal 11 (Segmentation fault)
Press the Enter key to close this terminal ...
can somebody help me with this problem
greating remco
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
Using the character pointer do the following code:
char *str = g_strdup((char *)msgEntry.get_text().c_str());
rfcomm_write(mc3t_bt_dev, str);
g_free((void *)str);
Bob Caryl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]