Hello. I need some help with something. I would like to run the WHOIS
program in the background, and get the output from that program. How
would I go about doing this in C?
--
Eric Phillips
Hello. I need some help with something. I would like to run the WHOIS
program in the background, and get the output from that program. How
would I go about doing this in C?
--
Eric Phillips
That is the part that I need the help with. Getting the stdout. How do I
get that? or how would I go about writing it to the file?
> I'm not that expert on this, but I would guess that one could
> use the C system function to execute the Unix whois command in the
> background writing its output to a file and then moving the file
> upon completion. What the file contained would be indicative of
> success or failure, and it's existance would indicate completion.
> No doubt someone else will shread this approach, and give you a good
> answer. :-)
> Chuck Demas
> Needham, Mass.
> --
> Eat Healthy | _ _ | Nothing would be done at all,
> Die Anyway | v | That no one could find fault with it.
I'm not that expert on this, but I would guess that one couldQuote:>Hello. I need some help with something. I would like to run the WHOIS
>program in the background, and get the output from that program. How
>would I go about doing this in C?
No doubt someone else will shread this approach, and give you a good
answer. :-)
Chuck Demas
Needham, Mass.
--
Eat Healthy | _ _ | Nothing would be done at all,
Die Anyway | v | That no one could find fault with it.
Use the popen(3) function.Quote:>Hello. I need some help with something. I would like to run the WHOIS
>program in the background, and get the output from that program. How
>would I go about doing this in C?
--
GTE Internetworking, Powered by BBN, Cambridge, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
> Use the popen(3) function.
/JAH
On Tue, 30 Jun 1998 17:54:17 +0000, Eric Phillips
>--
>Eric Phillips
example:
FILE *whoiscmd = popen( "whois", "r" );
------
Matt
------
- These views are my own, not necessarily those of my company.
system("command > file");
for appropriate command and file and read the file. That said, it is
probably simpler and safer to use the Unix-specific popen(). There
are some examples of the use of popen() in the comp.unix.programmer
FAQ, which is avalible from
http://www.erlenstar.demon.co.uk/unix/faq_toc.html or via FTP from
rtfm.mit.edu.
--
http://www.tardis.ed.ac.uk/~broonie/
EUFS http://www.eusa.ed.ac.uk/societies/filmsoc/
: That is the part that I need the help with. Getting the stdout. How do I
: get that? or how would I go about writing it to the file?
I hate to just recommend a book, however, check out _Advanced Programming
in the UNIX Environment_ by Stevens, assuming you are doing this on
Unix. Basicly it comes down to using fork() and dup(). If you need it
I have some code to do this (in C) but it is a bit much to post.
Roger
---------------------------------------------------------------------------
"Cryptography is like literacy in the Dark Ages. Infinitely potent, for
good and ill... yet basically an intellectual construct, an idea, which by
its nature will resist efforts to restrict it to bureaucrats and others who
deem only themselves worthy of such Privilege."
_ A thinking man's Creed for Crypto/ vbm.
---------------------------------------------------------------------------
1. program for read output of another program
Hello Unix's programmers,
I think you can help me. I have a program which sometimes
write a message on a file (it appends that message). But now I want
to write a program which detect when the program wrote any message
on the file.
I wrote a program which read the file and show me the messages
already writen and save the index on a file of the last message. After
do this my program stay testing the file verifying if the size change.
But I think there is another way to do this, using pipes or others
unix features. Does anybody have any idea?
thanks in advance
Delfim
3. Problem in Reading Program Output to a Shell Variable
7. directing output of programs that are arguments of other programs
9. Howto capture output from external program run from C program
10. how to read disk read & write i/o through a c/c++ program ?
11. Help: Program to read from EOR end of last read?
12. Any programs to read and run MAI BASIC-4 programs?
13. Call a perl program and read the results back to/from a c program