string不能接受的字符

    string temp = "wfewfwfw\=====";
    char cha1 = '\\';
    temp = cha1;
    printf("%s", temp);  //程序会奔溃
    const char* ch = temp.c_str();
    cout << cha1 << endl;
    replace_all(temp, "\\", "\\\\");
    cout << temp << endl;

猜你喜欢

转载自blog.51cto.com/haidragon/2327056