Hi I have two questions regarding system call in Unix in C language.
1. What function will I use to be able to open another console by using a system() in C? The scenario is to call an executable file inside the code and that executable will open another console(this is aside from the existing console used at run time).
2. The code is like this :
/* line 1 : */ char w_temp ;
/* line 2 : */ strcpy(w_temp,"ls -l tempdir " ) ;
/* line 3 : */ system(w_temp) ;
NOTE : tempdir is not an existing directory.
By executing these lines, the compiler execute automatically the system call "ls -l tempdir". My aim is not to write "No such file or directory" to the console even if the file/directory is not existing. In this case even if I catch the return of line 3 I cannot control its automatic writing of the result of my command ("ls -l tempdir"). My question is, is there a way for me to control the result of the system call before it writes to the console? Like in this case, I would want the code not to write to the console the result of the string I passed( "ls -l tempdir" ). The string is a parameter for my function.
That's all thank you!