>>>I've created a utility program which is essentially a workstation configuration tool. Now I'd like to be able to run it from the command line or from a batch file.
>>>
>>
>>VFP is a Winapp who's output is always directed to a Window, not a console. None of the native commands write to STDOUT. You'd have to fall back on writing through API calls, and completely hiding thr VFP main Window through CONFIG.FPW.
>
>I have wanted to do this forever. Can you give a simple "hello world" example?
Off the top of my head, without testing:
DECLARE INTEGER fopen IN MSVCRT.DLL AS _fopen ;
STRING @ lpFileName, ;
STRING mode
DECLARE INTEGER _lwrite IN WIN32API;
INTEGER nFileHandle, ;
STRING @ lpBuffer, ;
INTEGER nSize
DECLARE INTEGER fclose IN MSVCRT AS _fclose INTEGER hFileHandle
nFH = _fopen("STDOUT",;
"a")
cVar = "Hello, World" + CHR(13)+CHR(10)+CHR(0)
=_lwrite(nFH,cVar,15)
=_fclose(nFH)
This isn't the only way to do it. The AS clauses would be needed to avoid name collisions with internal VFP functions.