This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Argument parsing with gcc compiled program
- From: Marco Atzeri <marco dot atzeri at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 26 Nov 2015 21:20:00 +0100
- Subject: Re: Argument parsing with gcc compiled program
- Authentication-results: sourceware.org; auth=none
- References: <91DCAC3CB99C724EB365BB64677FBE7B01DD4B at MX204CL04 dot corp dot emc dot com>
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