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
Post a Comment