Pelles C forum

C language => User contributions => Topic started by: frankie on April 21, 2014, 06:43:05 PM

Title: CommandLineToArgv routine
Post by: frankie 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 (http://msdn.microsoft.com/en-us/library/a1y7w461.aspx)  >:(
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  ;)
Title: Re: CommandLineToArgv routine
Post by: Vortex 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
Title: Re: CommandLineToArgv routine
Post by: frankie 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)
Title: Re: CommandLineToArgv routine
Post by: TimoVJL on April 22, 2014, 08:12:08 AM
Nice work.