Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!Kushall.henr@XEROX.ARPA From: Kushall.henr@XEROX.ARPA Newsgroups: net.lang.c Subject: Re: Reading CPM/86 Command Line Message-ID: <11487@brl-tgr.ARPA> Date: Thu, 11-Jul-85 09:39:39 EDT Article-I.D.: brl-tgr.11487 Posted: Thu Jul 11 09:39:39 1985 Date-Received: Sat, 13-Jul-85 08:52:36 EDT Sender: news@brl-tgr.ARPA Lines: 39 I have been using the following method for reading the command line arguments from Turbo Pascal. (CP/M-86 version 2.0, Turbo Pascal version 2.0) Declare the following global variable: var CmdLine : String[128] absolute(DSeg:$80); { this is the location of the CP/M 86 Command line buffer} CmdLineString : String[128]; { used to save the command line } You must execute the following code before your program does any IO and destroys the buffer ! CmdLineString := CmdLine; { Copies the command line args into the safe area} Note that if length(CmdLine) = 0 then no args were passed. The data format of Dseg:$80 is as follows: The byte at Dseg:$80 is the nunber of characters passed in the cmd line after the name of the .CMD file called including the leading space. This will be CmdLine[0] in the Turbo Pascal string. Thus the string is returned by CP/M in the same format as required by Turbo. The same method can be used for CP/M 80 except the declaration is: CmdLine : String[128] Absolute $80; And for MS-DOS CmdLine : String[128] Absolute(CSeg:$80); It is my understanding that the CP/M-80 versions only allow a limited number of characters to be passed as arguments(arround 30) I have not verified this for any of the implementations. Turbo Pascal 3.0 includes 'standard' procedures for reading the command line arguments. Ed Kushall