🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3412

Re: Getting %1, %2, etc under Borland C

#3412
From: fred j mccall 575-3539
Date: Mon, 28 Sep 1992 18:44
38 lines
1951 bytes
In <1992Sep28.143744.1@wombat.newcastle.edu.au> c9106225@wombat.newcastle.edu.au (Matt McLeod) writes:


>OK.  This has probably been asked zillions of times before, but I'll ask again
>anyway...

>I'm trying to get ahold of the command line parameters (that is %1, %2, etc)
>within a Borland C Windows program.  I've tried the getenv() function, but to
>no avail, and there doesn't seem to be any other function around.

>Any ideas?

Uh, my first idea is that you should pick a language besides C.
Either that, or get a book on the subject and learn the language
before trying to program in it.

Command line parameters in C programs are gotten in in two parameters
that are arguments to main().  Declare your main like this --

	int main (int argc, char *argv[])

The argc argument will be the count of command line arguments when the
program is invoked.  The argv aregument is an array of pointers to
character, where the array entries are strings containing the command
line arguments.  argv[0] contains the name of the program.  This is
standard C.

>Thanks in advance,

Any time, but I seriously suggest that you're going to need to know a
LOT more about C than you apparently do.


-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
Technical Details
Message-ID: <1992Sep28.184409.3571@mksol.dseg.ti.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
References: <1992Sep28.143744.1@wombat.newcastle.edu.au>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: Getting %1, %2, etc under Borland C
Message-ID: <1992Sep28.184409.3571@mksol.dseg.ti.com>
Organization: Texas Instruments Inc
References: <1992Sep28.143744.1@wombat.newcastle.edu.au>
Date: Mon, 28 Sep 1992 18:44:09 GMT
Lines: 38