Imagine that you made a program that accepts userinput in this format:

cmd.exe
or
netscape.exe

this is a good input and the program accepts it, but what if the user enters this:

cmd
or
netscape

Must the programmer Flag this as an error and allow the user to correct his input or
make the program correct it for the user.

>Must the programmer Flag this as an error and allow the user to correct
>his input or make the program correct it for the user
That's up to the programmer. It's certainly easier in the general case to force absolute correctness from the end user, but the added convenience of omitting information that won't change can be the deciding factor in whether your software is used or not. However, adding a "fudge factor" into the input processing isn't always as simple as tacking on ".exe" if it's not there.

Most likely you would end up doing a search of the relative directory to see if the program is there, and then doing a search of your environment variables, and for good measure you might even want to do an approximate search to account for typos, which is considerably more complicated than an exact search. Once you find some matches, you'll then need to ask the user if that's what they really meant, and if there are more than one, which of those options, if any, were wanted, and get a response. All of this could actually take more time than simply asking for correct input to begin with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.