Help for Strings vs. Char

Hi all,

I'm working on debugging some code so that I can make changes to it.

Below is an approximation of the code, it's a function that receives a string pointer, but I don't know how to display the contents of that string, as I can't seem to find a way to convert the passed string pointer into a char*

String BasicComponentImplementation::specialRoutine(String &inputString) {
printf("Input : %s", inputString.c_str());
)

Fails in the build as
build>> In member function 'sys::lang::String <snip>::BasicComponentImplementation::specialRoutine(sys::lang::String&)':
build>> <snip>/BasicComponentImplementation.cpp:214:39: error: cannot pass objects of non-trivially-copyable type 'class sys::lang::String' through '...'
build>> printf("Input String: %S", inputString);
build>> ^

.c_str() doesn't work either, in the editor I just get ...
build>> <snip>/BasicComponentImplementation.cpp:214:40: error: 'class sys::lang::String' has no member named 'c_str'


Sorry, C++ isn't my first language, hence I've coming with cap in hand begging for help.
What is String? What library / framework do you use?
Ok you've obviously hit my problem and my lack of experience with C++ makes me want to crawl into a corner.

I'm not sure which libraries are being used that would contain String - I was sort of assuming it was part of the language. I'll go research some more and come back when I have further info. Thanks for the superfast response.

Thanks for your question which pointed me in the right direction.

I found the custom library that is being used to define the String object and studied the code, where I found a toCharArray() function. That did the trick :D
Topic archived. No new replies allowed.