如何防止丢失双引号在argv? [英] how to prevent losing double quotes in argv?

查看:303
本文介绍了如何防止丢失双引号在argv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我知道我可以这样做循环:

Ok, I know I can do loop like this:

for (int i=1; i<=argc-1;i++) {
  cout << argv[i] << endl;
}

但是这样双引号会丢失,这是一个字符串这里的东西被视为args数组的一个元素,引号丢失。

But this way double quotes are lost, that is a string "something here" is treated as one element of the args array and quotes are lost.

推荐答案

当你需要原始的命令行,则可以使用 GetCommandLine() API函数。

When you need the original command line, your can use the GetCommandLine() API function.

这篇关于如何防止丢失双引号在argv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆