General
cancel
Showing results for 
Search instead for 
Did you mean: 

execlp("sort", "sort", "<", argv[1], (char*)0); ??

SOLVED
Go to solution
eugene_6
Advisor

execlp("sort", "sort", "<", argv[1], (char*)0); ??

execlp("sort", "sort", "<", argv[1], (char*)0);

shouldn't it work?
what's wrong with the line above?
i can't use "<" ?? as an argument??

thank you!
2 REPLIES
Marco Paganini
Respected Contributor
Solution

Re: execlp("sort", "sort", "<", argv[1], (char*)0); ??

Hello Eugene,

No, it won't work. Redirection is handled by the shell. If you want to use redirection, use the system() call.

Regards,
Paga
Keeping alive, until I die.
eugene_6
Advisor

Re: execlp("sort", "sort", "<", argv[1], (char*)0); ??

ah..

what were i thinking..

--;
system()? ok

i could have used
open()
close(1)
dup(3)

--;
all right