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
>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