Hi all,
I have a small app (one prg) with an LPARAMETERS statement at the begining of it. The idea is to accept a file name as an input parameter. The app issues a STRTOFILE() (to a different file from the input) in a few places in the code. If I run the exe from Windows Explorer (or the Run dialog) without a parameter, the app runs and writes to the output file via STRTOFILE() just fine stating that an invalid file was passed. If I run the app from within the VFP IDE or the Windows Run dialog with a parameter, all runs well. BUT, if I drag a file onto the exe, the app runs fine, processing the input file, but doesn't write the output via STRTOFILE() (or FOPEN(), FPUTS(), FCLOSE(), etc.) and no error is returned. In fact, if I check the return value of STRTOFILE() or FPUTS(), they both return the number of bytes they should have written. It's like dropping a file onto the exe locks the I/O buffer in Windows or something. I've even tried issuing a CLOSE ALL within the application to try to force that lock off.
Has anyone else seen this? Any ideas? Other than just to not drag and drop a file onto the exe...
Without testing this code, I'd bet this will show what I'm talking about. Just put this in a PRG and compile it into an EXE and run it various ways:
LPARAMETERS tcInput AS String
STRTOFILE(TRANSFORM(DATETIME() + ' - ' + TRANSFORM(tcInput) + CHR(13) + CHR(10), 'Output.txt', 1)
TIA,
_________________________________
There are 2 types of people in the world: