Hasan Quadri "Windows isn't a virus, a virus does something!"
qua...@remus.rutgers.edu
http://remus.rutgers.edu/~quadri/index.html
If you want to use a system call to do this use pipe(), if you want to
use *FILE constructs, use popen(). Basically, they fork a child and
give you a file descriptor that you can use to read the output of the
child (for example, into a character array)
--
Demetri S. Mouratis ds...@hobbit.ntrs.com
The Northern Trust Company Voice: +1 312 630-0735
Chicago, IL 60675 FAX: +1 312 630-6797
"The mere act of drinking beer in an attempt to measure your tolerance
is likely to affect your impression of how many beers you've drunk."
-- The Heineken uncertainty principle.
Or, more explicitly:
char buf[999];
FILE *pp;
pp = popen("ls", "r");
if (pp == 0) exit(1);
while (fgets(buf, sizeof buf, pp) != 0) {
... do something with buf ...
}
pclose(pp);
--
Mischa Sandberg ... Mischa_...@mindlink.bc.ca
Engineers think equations approximate reality.
Physicists think reality approximates the equations.
Mathematicians never make the connection.