system system call usage
Hi All,
I am facing one problem with system function call. I have used the system function call in my program like system("ls -R | grep \"old\"") and based on the return value I take some decision. I have compiled and copied to /usr/bin. My program name is MyProgram. Since I have used ls here and It gives me proper listing. But after few days or some time, it stops suddenly working ... it says sh: ls:command not found I donnaaa what is happening here ... Is it the problem with the usage of the system function call or something else. I am not able to debug what is happening. But if I recopy MyProgram binary to /usr/bin again... It works fine. Please help me. I am using FC 4 Thanks, Suresh |
always use the full path: system("/blah/blah/blah/command")
|
Thanks a lot, It may help for me.
|
In ur system call, just give the absolute path of ls command.
i.e, /bin/ls I hope it should work. |
All times are GMT -5. The time now is 02:17 PM. |