>When I use WinExec() to run the following DOS command > >copy > lpt1 > >the function returns the value 2. >
Error 2 is 'File not found'
>I am needing to know what this code means and/or if there is somewhere I could get a listing of all possible error codes. Also can this command be successfully used with WinExec() or should I try something else such as ShellExec().
The errors are documented in the MSDN; the best single source is the .H files for VC++; in this case, WINERROR.H provides the details.
WinExec() is present only for backwards compatibility with Win16; it's been largely superceded by CreateProcess() and ShellExecuteEx(). I wrote a class called API_APPRUN, available for download here on UT, that implements program execution using CreateProcess(); you might want to examine it.
FWIW, the commandline you've given is completely invalid in any case; if you want to copy a file's exact content to LPT1, you'd use something like:
COPY /B filename LPT1.DOS
This functionality is available without resorting to API calls or external commands with the VFP TYPE command, or with COPY FILE, or any of a number of other options.