D
Denis Remezov
Sean said:I'm sure this might be a simple questions, but here it goes anyway. I
am trying to do a 'front end' to a program. For example I have a
program that doesn't take command line arguments, but prompts the user
for input every time it is run, ie. Enter your name:
I want to run a program that will automatically type the name into
that field. I just don't really know where to start. Is this
suppossed to be a spawn or an exec? I saw something about pipes, but
didn't quite get it. Please explain for me.
This is NOT for a class, just trying to learn how to do things
You could possibly make the use of the following:
Both C++ and C define three "standard streams": stdin, stdout and stderr.
The type of these expressions is FILE*, and they are required (I think;
need to double-check) to be open at the program start-up. See <stdio.h>
or <cstdio>.
The C++ objects cin, cout and cerr use the respective standard streams as well.
Now, what is hiding behind each of the standard stream depends on the way
the program was started (they could be attached to the terminal, to files,
to streams of another program, etc.). This part, however, is indeed system
dependent. One thing that is standard is the system() function, but its
behaviour is again system dependent.
Denis