Char*, char[] and std::string

I have a question about the above types. There is a lot of complication when dealing with the conversion between these types and many people recommend just using strings entirely throughout your program. However I lot of APIs if that is the correct term use char* in there functions which means you need to be able to convert between strings and char* anyway. I have found that strings are better suited for things like comparisons and such whereas char* is no good for that. Would just like some professional opinions here thank you.
std::string is C++ only, whereas many APIs are written in C.

Conversion between std::string and C-style character arrays is trivial, but you still need to be aware of where those character arrays came from and are going - some C APIs will do weird things with them or will require you to free the memory associated with them.
Last edited on
Topic archived. No new replies allowed.