1 /*
2 图灵机器人 C++实现3
4 极简版5 几乎没有界面(废话,毕竟是控制台)6
7 代码参考自微软提供的例子,见:8 https://msdn.microsoft.com/en-us/library/windows/desktop/aa384104(v=vs.85).aspx9 */
10
11 #include
12 #include
13 #include
14 #pragma comment(lib,"winhttp.lib")
15
16 #define TULING_URL L"www.tuling123.com/openapi/api?key=这里换成你自己从图灵申请的API啦&info=%s"
17 static wchar_t String[1024];18
19 //编码转换
20 char *UnicodeToANSI(const wchar_t *str)21 {22 static char result[1024];23 int len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);24 WideCharToMultiByte(CP_ACP, 0, str, -1, result, len, NULL, NULL);25 result[len] = '\0';26 returnresult;27 }28 wchar_t *UTF8ToUnicode(const char *str)29 {30 static wchar_t result[1024];31 int len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);32 Multi