how to convert? C-string format of toStirng()

Here is the function:

string toString(){
    string tmp;

    char buf[80];
    if (*d != 1)
        sprintf_s(buf, "%d/%d", *n, *d);
    else sprintf_s(buf, "%d", *n);
    tmp = string(buf);

    return tmp;
}

need a c-string format of toString(), don't know how to do; plz help.. char *str();


Click here view more answers http://ift.tt/20RXAjx