Command line argument (filename)

Some of the arguments my program takes are file locations. As file names can contain a space the argv could be parsed half way through a path which is unwanted. What is the easiest way of retaining the space in the filename?

You don't need to worry about that if your quote them. It's not something you should have to worry about. It's a worry of the person/program calling your app.

For example, do you think mkdir cares about that stuff? You have to quote the input yourself.
mkdir "/tmp/test directory"
Enclose each file name in double quotes.
Topic archived. No new replies allowed.