Skip navigation.
Home
The QNX Community Portal

View topic - Does PtSetResource support string?

Page 1 of 1

Does PtSetResource support string?

PostPosted: Mon Oct 29, 2012 6:21 pm
by summerluv
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!

Re: Does PtSetResource support string?

PostPosted: Mon Oct 29, 2012 7:09 pm
by mario
s.c_str()

Re: Does PtSetResource support string?

PostPosted: Tue Nov 06, 2012 1:15 am
by summerluv
Thank mario!