Article View: net.micro.pc
Article #8430Re: Argv[0] in TURBO PASCAL
From: Jim Greenlee
Date: Tue, 21 Oct 1986 02:05
Date: Tue, 21 Oct 1986 02:05
53 lines
2448 bytes
2448 bytes
In article <623@A60.UUCP> lee@A60.UUCP (Gene Lee) writes:
>
> Can anyone tell me how to get the Program name ( the name the
> program was called by ) from Turbo Pascal? Lattice C does it so
> I know it can be found. I just don't know where in memory MS-DOS
> keeps it. Thanks in advance
>
>
>--
>Gene Lee UUCP: ...ihnp4!{meccts,dayton,rosevax}!ems!A60!lee
>Sperry Corporation ATT: (612) 635-6334
Turbo Pascal does not support equivalent procedures to the argv()
and argc() functions found in most C (and in some Pascal) libraries.
To get at the command line from within Turbo, you have to address
the memory location(s) where the command line is stored. The following
(from Borland's "Turbo Tutor" book) will access arguments passed to
a program:
============================ cut here ================================
program CommandLine;
{ This program demonstrates how to get information off the command
line. One thing you must remember-32 characters are always
there for you to use-if you want to use the full 127, the first
statement in your program must parse the command line and retrieve
the information as any subsequent reads or writes will shorten the
command line to 32 characters. }
type
CommandString = string [127];
var
Buffer : CommandString;
CL : CommandString absolute cseg:$80;
begin
Buffer := CL;
Gotoxy(20,12);
Writeln('|',Buffer,'|');
end. { of program CommandLine }
============================== cut here =============================
The book mentions that this is only good for getting arguments above
arg(0), which doesn't really solve your specific problem, but I hope
it is of some general use.
Jim Greenlee
--
The Shadow
Georgia Insitute of Technology, Atlanta Georgia, 30332
...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!jkg
Technical Details
Message-ID:
<2444@gitpyr.gatech.EDU>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cuae2!gatech!gitpyr!jkgReferences:
<623@A60.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cuae2!gatech!gitpyr!jkg From: jkg@gitpyr.gatech.EDU (Jim Greenlee) Newsgroups: net.micro.pc Subject: Re: Argv[0] in TURBO PASCAL Message-ID: <2444@gitpyr.gatech.EDU> Date: Mon, 20-Oct-86 22:05:27 EDT Article-I.D.: gitpyr.2444 Posted: Mon Oct 20 22:05:27 1986 Date-Received: Wed, 22-Oct-86 06:02:46 EDT References: <623@A60.UUCP> Reply-To: jkg@gitpyr.UUCP (Jim Greenlee) Organization: Georgia Institute of Technology Lines: 53