it is possible to send bash commands into a c application right?
for example if i wanted to do a "wget http://example.com" inside a c application how would this be done?
it is possible to send bash commands into a c application right?
for example if i wanted to do a "wget http://example.com" inside a c application how would this be done?
Lookup popen()
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I tried this
but got an error ofCode:#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { popen("wget http://google.com", "w"); }
sh: wget: command not found
im using mac and have installed wget and can use it via console, any ideas?
Use the full path to wget? Run "which wget" in the console to find it.
ah, thank you that worked
i installed via fink and it put it in a different dir not /usr/bin/wget as usual
----
i tried this to get the location inside the c program
popen("/usr/bin/which wget","w");
however get no response, any ideas?
--
never mind its just due to some messed up dirs on my mac lol
Last edited by starternewb; 03-15-2011 at 05:42 AM.