Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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