0

I've created a program that will process a file in a certain manner. The processing works fine, the problem I'm having is to open files that has a " " (space) in their dir or filename. See I wanted to be able to use my program in a easy manner on files so I set it up in the registry (added a key for my program in HKEY_CLASSES_ROOT\*\shell). It looks something like this "myprogram.exe %1" (I guess the %1 is the current file being clicked on).

My program already retrieves the file to process via argv[1]. This worked fine when I clicked on files in c:\ with no space in their filename. However as soon as there is a space in the dir or in the filename, my program will fail to open the file. I'm using fstream library for the I/O operations on the file. How can I solve this problem?

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by ctpsolo
0

I solved my own problem. It was as easy as adding "" in the shell key, like this: myprogram.exe "%1", works without any flaws now.

Edited by ctpsolo: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.