I am trying to understand how I am supposed to execute the following command wc < wc.in
in C without using any exec()
function?
Asked
Active
Viewed 119 times
0

user1162954
- 267
- 2
- 4
- 7
-
1Why do you have to do it without `exec()`? – dreamlax Jan 31 '12 at 00:39
-
1Does this have anything to do with [your previous question](http://stackoverflow.com/questions/9070177/redirecting-output-of-execvp-into-a-file-in-c), because if it does, you should update that question instead of asking a new one. – dreamlax Jan 31 '12 at 00:40
1 Answers
2
You could try using system
instead.

lhf
- 70,581
- 9
- 108
- 149
-
+1: it works if the question means 'without calling `exec()` family functions directly in your code. Otherwise, most likely `system()` uses an `exec()` family function behind the scenes - unless you're on a system where you can use the [`posix_spawn()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html). However, using that is _hard_ work; really hard work. – Jonathan Leffler Jan 31 '12 at 01:16