Skip navigation.
Home
The QNX Community Portal

View topic - Does PtSetResource support string?

Does PtSetResource support string?

Isn't the name clear?

Does PtSetResource support string?

Postby summerluv » Mon Oct 29, 2012 6:21 pm

Hi,
I'm writing a C++ application, so I'm trying to use strings instead of character arrays/pointers. However, I'm not sure if QNX really supports strings. For example:

This works:
Code: Select all
char buffer[MAX_INFO_SIZE] = "N/A";
PtSetResource(ABW_MyLabel, Pt_ARG_TEXT_STRING, buffer, 0);


But this does not:
Code: Select all
string s = "N/A";
PtSetResource(ABW_MyLabel, Pt_ARG_TEXT_STRING, buffer, 0);


The error given in the second case is "invalid cast from type std::string to type long int".
Does that mean I'm stuck to using character arrays?

Thanks!
summerluv
New Member
 
Posts: 7
Joined: Mon Oct 29, 2012 6:03 pm

Re: Does PtSetResource support string?

Postby mario » Mon Oct 29, 2012 7:09 pm

s.c_str()
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: Does PtSetResource support string?

Postby summerluv » Tue Nov 06, 2012 1:15 am

Thank mario!
summerluv
New Member
 
Posts: 7
Joined: Mon Oct 29, 2012 6:03 pm


Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 2 guests