Dl_zyy 2018-12-09 15:35 采纳率: 100%
浏览 710
已采纳

输入中文后总是乱码,麻烦大神帮忙看一下,万分感激!

语言:C++
编译器:Visual Studio 2017

#include <Windows.h>
#include <string>
#include <cstdlib>
#include <direct.h>
#include <stdio.h>

//获取当前目录
std::string GetPath() {
    char buffer[MAX_PATH];
    _getcwd(buffer, MAX_PATH);
    return buffer;
}

//创建文件夹
std::string NewFolder(const char * _name) {
    using namespace std;
    string command = "md "; 
    command += _name;
    system(command.c_str());
    string path;
    path = GetPath();
    path += "\\";
    path += _name;
    return path;
}
  • 写回答

1条回答 默认 最新

  • threenewbee 2018-12-09 15:46
    关注

    把string换成wstring
    char *换成wchar_t *

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?