how to deal with "<",">" and ">>" ? [message #118390] |
Wed, 01 September 2004 10:31  |
Eclipse User |
|
|
|
Originally posted by: Jack.wang.nicta.com.au
What can I do when running my C/C++ programme I want input some file such
as in command line "./execute /staff/phone < simple.xml"?
And if I want output to some file such as
"./execute /staff/phone < simple.xml >> output.txt" in command line?
I tried put them in "Arguments" block but seems not work.
Please help and thanks in advance.
|
|
|
Re: how to deal with "<",">" and ">>" ? [message #118595 is a reply to message #118390] |
Wed, 01 September 2004 12:57   |
Eclipse User |
|
|
|
Originally posted by: dejan.nu6.org
Hi Jack,
everything after "<" in your application command line is not in argv/argc.
Simply it's "shell business". If you want to "take" data, like in your
example, ./execute /staff/phone < simple.xml , than you simply fopen()
stdin, read from it, process it etc.
If you want something like:
../execute /staff/phone > simple.out
Than you simply do printf() because printf() is actually some form of
fprintf(stdout,...) (or maybe fputs() - i am not sure). So it is very, very
simple - you simply use fread(stdout, ...) to get data and printf(...) to
send data to standard output. SHELL is doing all those redirections and
streaming to some files...
Kind regards
--
Dejan Lekic
developer, sysadmin and DBA
http://dejan.lekic.org
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03576 seconds