system call with user input

This is a discussion on system call with user input within the C Programming forums, part of the General Programming Boards category; after my first week of reading and doing some tutorials i decided to try my own program. i run a ...

system call with user input

after my first week of reading and doing some tutorials i decided to try my own program. i run a liux machine with enlightenment desktop. so i decided to try a menu c program to make some things easy for me. i know bash shell scripting and wrote a nice script, but want to import it to the C lanquage.

i am trying to call the whois command with the domain name from the user input for the domain name or ip address. the problem is after calling the whois -h whois.arin.net command i need the doman or ip to follow to be able to look it up. please help with suggestions. if i can learn this, that will help me out a lot with other programs i want to take from the bash script to the C language. this is just one of many that will be linked to one large c program.

here is the code.

do i use the gets or scanf or would it be better to use a pointer. ?????????

>>scanf("%d", &ipadd);
An IP address is not a valid int. Remember it looks like this:
123.123.123.123
scanf() will simply read the first 123, hit the dot, and stop. You'll have to read the input as a string with fgets(), just don't forget to remove the newline character (mentioned in the links I posted).