Hi,
try this. It is based on replies I received to the same question a few
months ago (sorry, can't remember the respondent's name to attribute it
properly).
regards,
Bob
MODULE Console; (* Windows specific. Must be linked as a console application
- ie no GUI *)
IMPORT SYSTEM, WinApi;
VAR
StdIn,
StdOut : WinApi.HANDLE;
PROCEDURE Read* ( OUT string : ARRAY OF CHAR; VAR res : INTEGER );
VAR
n,
read : INTEGER;
ol : WinApi.OVERLAPPED;
BEGIN
string := "";
n := LEN( string );
IF WinApi.ReadFile( StdIn, SYSTEM.ADR(string), n, read, ol ) = 0 THEN
res := WinApi.GetLastError()
ELSE
res := 0;
END;
IF read < n THEN
string[read] := 0X
END;
END Read;
PROCEDURE Write* ( IN string : ARRAY OF CHAR; VAR res : INTEGER );
VAR
n,
written : INTEGER;
ol : WinApi.OVERLAPPED;
BEGIN
n := LEN( string$ );
IF WinApi.ReadFile( StdOut, SYSTEM.ADR(string), n, written, ol ) = 0 THEN
res := WinApi.GetLastError();
ELSE
res := 0;
END;
END Write;
BEGIN
StdIn := WinApi.GetStdHandle( WinApi.STD_INPUT_HANDLE );
StdOut := WinApi.GetStdHandle( WinApi.STD_OUTPUT_HANDLE );
END Console.
----Original Message Follows----
From: "Treutwein; Bernhard" <Bernhard.Treutwein{([at]})nowhere.xy
To: blackbox{([at]})nowhere.xy
Subject: Accessing the commandline (argc & argv)
Date: Thu, 3 Aug 2000 08:46:19 +0200
Hi folks,
is there a way to access the commandline, i.e., to what
every C program has in the arguments to main ?
regards
Bernhard Treutwein Tel. 089/2180-2774
Bernhard.Treutwein{([at]})nowhere.xy
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word
"unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send
a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list
owner at
owner-blackbox{([at]})nowhere.xy
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com
Received on Thu Aug 03 2000 - 08:51:44 UTC