NO

Author Topic: CommandLineToArgv routine  (Read 4405 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
CommandLineToArgv routine
« on: April 21, 2014, 06:43:05 PM »
I needed a routine to mimic command line arguments packing.
Windows offers CommandLineToArgvW, that works only with unicode, but, most rilevant, is not compatible with MS guidelines reported here  >:(
Something is available on the net, but still not compliant.
So I wrote it... 8)

EDIT: I forget to evaluate the tab as separator. Fixed  ;)
« Last Edit: April 22, 2014, 12:50:21 AM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline Vortex

  • Member
  • *
  • Posts: 867
    • http://www.vortex.masmcode.com
Re: CommandLineToArgv routine
« Reply #1 on: April 21, 2014, 09:27:17 PM »
Hi Frankie,

It depends on what are you trying to achieve. My small C run-time library does not follow the standards of that guideline but it meets my requirements. As an alternative, did you try the __getmainargs function exported by msvcrt.dll ?

http://msdn.microsoft.com/en-us/library/ff770599.aspx
Code it... That's all...

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: CommandLineToArgv routine
« Reply #2 on: April 21, 2014, 10:25:13 PM »
Thanks Vortex  :D
Well the rules from MS have a sense: they allows you to pass device or network paths even with embedded spaces (they have more backslashes before any char).  ;)
That's why I wrote this one by myself that is it fully compliant ...  8)
« Last Edit: April 21, 2014, 10:27:16 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: CommandLineToArgv routine
« Reply #3 on: April 22, 2014, 08:12:08 AM »
Nice work.
May the source be with you