[Bug c++/44399] New: Problem with command line arguments in windows

Andrew Pinski pinskia@gmail.com
Thu Jun 3 13:48:00 GMT 2010



Sent from my iPhone

On Jun 3, 2010, at 5:15 AM, "alexandrfedorov at gmail dot com" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

> I'm trying to write windows console application working with  
> directories, and i
> discover that arguments processed not right. For example:
>
> #include <iostream>
> int main ( int argc, char *argv[], char *envp[] ) {
> std::cout << "you have " << argc << " arguments";
> }
>
> resulting:
>
>> a.exe "a a"
> you have 2 arguments

This is correct because the first argument is a.exe.


>> a.exe "a a" a
> you have 3 arguments
>> a.exe "a a\" a
> you have 2 arguments
>
> As i understand, backslash is escaping double quote and we have [a  
> a" a]
> argument instead of [a a\],[a].
> It's very sad, because i must operate with directories or UNC paths  
> like:
> "\\serv\share\some dir with spaces\" where double quotes is required  
> and
> backslash can be present.
>
> Quoting long file paths with double quotes and backslashes in paths  
> is a common
> thing in windows console programs.
>
>
> -- 
>           Summary: Problem with command line arguments in windows
>           Product: gcc
>           Version: 4.4.3
>            Status: UNCONFIRMED
>          Severity: normal
>          Priority: P3
>         Component: c++
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: alexandrfedorov at gmail dot com
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44399
>



More information about the Gcc-bugs mailing list