How can I pass a command line argument which contains space character to my C++ program?

  argc, argv, c++, dev-c++, whitespace

We can access command line arguments via argv code in C++, I know that.

But the problem is, if an argument contains space, then my program works like as if there are two parameters.

For example if the argument is foo bar, my program sees two parameters (foo and bar).

Here is my code:

string strParameter = string(argv[1]);

So, what should I do?

Source: Windows Questions C++

LEAVE A COMMENT