Command line as a stream?
Barry Margolin
barmar at think.COM
Sun May 1 10:34:49 AEST 1988
In article <404 at lscvax.UUCP> ram at lscvax.UUCP (Ric Messier) writes:
>Since I know input gets buffered, I am assuming that that buffer can be
>opened by specifying it in a stream. Am I wrong in this assumption? Any
>help would be greatly appreciated!! Thanks!
First of all, you can't be sure that your command was actually called
by the shell. It might have been invoked by a program calling
system() or exec().
When it is called from the shell, the command line is buffered, but
unfortunately it is not anywhere accessible to the program. It is
buffered in the shell's process, but the command is run in a separate
process.
The best thing for you to do would be to have a pair of global
variables, global_argc and global_argv, and have main() do
global_argc = argc;
global_argv = argv;
Then you can refer to these from anywhere in your program.
Barry Margolin
Thinking Machines Corp.
barmar at think.com
uunet!think!barmar
More information about the Comp.unix.questions
mailing list