Argument parsing with gcc compiled program
Marco Atzeri
marco.atzeri@gmail.com
Thu Nov 26 20:30:00 GMT 2015
On 26/11/2015 21:08, Gluszczak, Glenn wrote:
> For some reason when I compile a C program in gcc, double backslashes within quotes are stripped.
> But if I compile with Visual Studio this does not happen. I used a small
> test program to demonstrate.
>
> VS
> c:\msvc2010_SP1\VC>a.exe -s something "something d\:\\hello"
>
> Command-line arguments:
> argv[0] a.exe
> argv[1] -s
> argv[2] something
> argv[3] something d\:\\hello
> CL: a.exe -s something "something d\:\\hello"
>
>
> GCC
> $ ./a.exe -s something "something d\:\\hello"
>
> Command-line arguments:
> argv[0] ./a
> argv[1] -s
> argv[2] something
> argv[3] something d\:\hello
> CL: K:\sat-misc\src\sat-main\sat\src\wiz\a -s something "something d\:\hello"
>
> Is there some compiler option or setting I'm unaware of?
> Thanks,
> Glenn
>
bash is stripping the double backslashes
when using " , try '
$ ./a.exe -s something 'something d\:\\hello'
Command-line arguments:
argv[0] ./a
argv[1] -s
argv[2] something
argv[3] something d\:\\hello
CL: "E:\cygwin64\tmp\a.exe"
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list