TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: SIMON AVERY
from: BOB STOUT
date: 1998-04-25 16:10:00
subject: Getting the command line

On , Simon Avery (2:255/90@fidonet) wrote: 
 > DOS 7 (Win95) sets the environment CMDLINE to pass the full command-line.
 > Eg:
 > C:\>SET
 > CMDLINE=edit \GOLDED\GOLDED.cfg
 > That's not particularly portable though. AFAIK - the only decent way is to
 > use argv[] from main, noting that there will be one space twixt each entry
 > (or more - depends on what you expect to be passed to your program).
Simon...
  You didn't need to wait long! ;-) The obvious exception is that before 
parsing the command line into the argv[] array, it first strips out any and 
all redirection and/or piping operators. For example if you have a filter, 
FOO.EXE, which expects input from stdin, output to stdout, and error message 
to stderr, your command might look like...
FOO  FUBAR | XYZ
...in which case, neither BAR, FUBAR, nor XYZ, nor any of the operators will 
show up in the aargv[] array. If you want to be *really* OS-specific, you 
could always look at the 128-byte command buffer in the PSP...
 
--- QM v1.00
---------------
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.