【发布时间】:2012-06-28 20:38:42
【问题描述】:
我在使用 Visual Studio 2008 时遇到了一些问题。非常简单的程序:打印作为参数发送的字符串。
为什么会这样:
#include <iostream>
using namespace std;
int _tmain(int argc, char* argv[])
{
for (int c = 0; c < argc; c++)
{
cout << argv[c] << " ";
}
}
对于这些论点:
program.exe testing one two three
输出:
p t o t t
?
我尝试用 gcc 代替,然后我得到了整个字符串。
【问题讨论】:
-
另请注意,argv[0] 是程序名称,因此不是参数之一。悬而未决的观点,但可能有益于此网页上发生的未来文明。
标签: c++ visual-c++ unicode argv