Pelles C forum

C language => Windows questions => Topic started by: tpekar on April 24, 2014, 07:01:23 PM

Title: How do I get argv[0] in windows?
Post by: tpekar on April 24, 2014, 07:01:23 PM
In a console program the path and program name (and suffix) is available in the argv array as argv[0].  How do I get this in windows? ???
Title: Re: How do I get argv[0] in windows?
Post by: TimoVJL on April 24, 2014, 07:08:49 PM
GetCommandLine() and find first space (outside ").
Or use frankie's code from here (http://forum.pellesc.de/index.php?topic=6181.msg22673#msg22673)
Title: Re: How do I get argv[0] in windows?
Post by: tpekar on April 24, 2014, 08:03:39 PM
Thanks timoVJL.  I found where I had user GetModuleFileName in a program to get it.  Have not tried GetCommandLine before.