Converting char * into the string?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Converting char * into the string?

Kevin Peterson
Hi,

I have a function which takes string as an argument, but while calling this function I am actually passing char * (not const char *). This function uses the argument and populate the private variable which is of string type.

In the product its showing some strange behaviour i.e. crashing once in a while (not always) in other function while accessing the string variable which is class variable. Just want to check if the issue is with the passing of the variable which is of char * type.

    void myfunc(char * Id)
    {
        abc.fetchInfo(Id);
        ...
        ...
    }

    Definition of the fetchInfo
    fetchInfo(std::string Id);

Thanks,
Kevin Peterson



_______________________________________________
help-gplusplus mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-gplusplus