2

I didn't really know how to even look for the solution for this one. My problem is, how to execute system commands in c++ using function system(); but for more arguments(Come on it sounds awful). Let me explain: Try for example to type something like this in termianl:

lynx www.somewebsiteidunnowhatever.com -get_data

And here we go, empty line asking us for input. You can type something like:

name=travis&age=45&hobby=football
---

After that we would see some result. Now I can't manage how to achievie such behaviour with system(); My c++ script stop responding when that empty line occures. Please help...

1
  • I'm not sure that lynx works well with a FIFO on standard input instead of a TTY device. I understand that this is an example, but wget and curl generally do better jobs at downloading stuff from the command line. Mar 10, 2015 at 20:22

1 Answer 1

5

I suggest you use the format such as following format.

system("echo \"name=travis&age=45&hobby=football\" | lynx www.somewebsiteidunnowhatever.com -get_data");

using pipe(|), you can give a any command's output to any commands as it's input.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .