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 test1 test2 "testing testing"
should be
argv[0] = "test.exe"; argv[1] = "test1"; argv[2] = "test2"; argv[3] = "testing testing";
I realize that cmdLine doesn't have the program name (the argv[0]); this doesn't matter I can use a dummy value.
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