'FILE_TYPE_CHAR'에 해당되는 글 1건
2007/09/20 08:33
How to determine the output of a console application ?
2007/09/20 08:33 in Borland Delphi

Use the code below to find where the output is going:
program SampleConsoleApp;
{$APPTYPE CONSOLE}
uses
SysUtils, Windows, Dialogs;
var
hStdOut: THandle;
begin
writeln('Some output') ;
hStdOut :=GetStdHandleSTD_OUTPUT_HANDLE) ;
if hStdOut = INVALID_HANDLE_VALUE then RaiseLastOsError;
caseGetFileType(hStdOut) of
FILE_TYPE_UNKNOWN:
ShowMessage('Unknown output ') ;
FILE_TYPE_DISK:
ShowMessage('Output to a File') ;
FILE_TYPE_CHAR:
ShowMessage('Console output') ;
FILE_TYPE_PIPE:
ShowMessage('Pipe output') ;
end;
end.
{
When this app is run "normally"
it will display a 'Console output' message.
}
{$APPTYPE CONSOLE}
uses
SysUtils, Windows, Dialogs;
var
hStdOut: THandle;
begin
writeln('Some output') ;
hStdOut :=GetStdHandleSTD_OUTPUT_HANDLE) ;
if hStdOut = INVALID_HANDLE_VALUE then RaiseLastOsError;
caseGetFileType(hStdOut) of
FILE_TYPE_UNKNOWN:
ShowMessage('Unknown output ') ;
FILE_TYPE_DISK:
ShowMessage('Output to a File') ;
FILE_TYPE_CHAR:
ShowMessage('Console output') ;
FILE_TYPE_PIPE:
ShowMessage('Pipe output') ;
end;
end.
{
When this app is run "normally"
it will display a 'Console output' message.
}
Prev

Rss Feed