问题描述
我要的的WinMain
CMDLINE
参数转换为 ARGC
和的argv
这样我就可以使用参数解析功能,我写的控制台应用程序。
I want to convert WinMain
's cmdLine
argument to argc
and argv
so I can use the argument parsing function I wrote for console applications.
这是除了我要支持引号太微不足道了。例如:
This would be trivial except that I want to support "quotes" too. For example:
test.exe的测试1测试2测试测试
应
argv[0] = "test.exe"; argv[1] = "test1"; argv[2] = "test2"; argv[3] = "testing testing";
我认识到,CMDLINE没有程序名(的argv [0]);这不要紧,我可以使用一个虚拟值。
I realize that cmdLine doesn't have the program name (the argv[0]); this doesn't matter I can use a dummy value.
我想用正则表达式做,(([^] +)\\ S +)的|(([^ \\ S] +)\\ S *)
我不知道这将如何工作,但..也许不是很好?有没有什么函数来完成,在Windows API的?谢谢
I was thinking of doing it with a regex, (("[^"]+")\s+)|(([^\s]+)\s*)
I'm not sure how well it would work though.. Probably not very well? Is there any function to do that in the windows api? Thanks
推荐答案
的看起来将是有益的。
这篇关于在旧式主打破WinMain函数的CMDLINE()的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!