如果我使用以下main()方法运行C ++应用程序,则一切正常:
int main(int argc, char *argv[])
{
cout << "There are " << argc << " arguments:" << endl;
// Loop through each argument and print its number and value
for (int i=0; i<argc; i++)
cout << i << " " << argv[i] << endl;
return 0;
}
我得到了我的期望,并且我的论据被打印出来。
但是,如果我使用_tmain:
int _tmain(int argc, char *argv[])
{
cout << "There are " << argc << " arguments:" << endl;
// Loop through each argument and print its number and value
for (int i=0; i<argc; i++)
cout << i << " " << argv[i] << endl;
return 0;
}
它仅显示每个参数的第一个字符。
造成这种情况的区别是什么?