-
find in system()
I have a system() call with a find statement in it but i don't want the results printed.
I know that -print is automatic unless you specify -ok.
when i do i get errors --->>
find: 0652-018 An expression term lacks a required parameter.
Code:
system("find . -type d -name \"savedir\" -ok ")
-
make sure that you are adding the header file #include <stdlib.h> <-- this file is needed to run system commandz
-
Hi,
The problem lies with your use of the -ok switch (-ok requires an argument). The -ok switch will execute another application, just like -exec, but will prompt the user before each execution.
If you do not want the results of find to be sent to stdout, redirect them:
Code:
system( "find . -type d -name \"savedir\" > /dev/null" );
Also, the quotation marks around savedir are not necessary, so the following is also valid:
Code:
system( "find . -type d -name savedir > /dev/null" );
Cheers,