c++ - use of char * vs std::string in different environments -


I am using std :: string in my code. I was going to create a std :: string and pass it by reference. However, some std :: string is not reliable about the code suggested to use four *. is it true? I have avoided using four * because I have to manage some of the memory for this instead I find it very easy to use std :: string to use.

Actually I have a 10 digit output that I am storing in this string. Atm, I'm not sure which one would be better to use.

In C ++, almost every string should be Std :: string unless another library Cstring is not required, in this case you are still std :: string and string.c_str () passing, unless you are using the function that works with buffers.

However, if you are writing a library and exporting the function, it is better to use port charity instead of the const char * parameter instead of the std :: string parameter.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -