LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to disable console output (https://www.linuxquestions.org/questions/programming-9/how-to-disable-console-output-188681/)

kamel 06-01-2004 10:43 PM

How to disable console output
 
I would like to disable console output. For example when I do:

system("ls -d ~/dirname > logfile.log"); to determine is a folder exists, if it doesn't the text "folder does not exist" is outputted into the console which is really annoying when writing curses progarms. How can I get it to stop?

rkef 06-01-2004 11:17 PM

What you're redirecting in your shell command there, is just the stdout (file descriptor 1). You need to either specify &>logfile.log, for example, or 2>/dev/null and > logfile.log to junk the stderr (file descriptor 2).

kamel 06-02-2004 01:41 PM

ah! thank you very mich :) a nice, quick, simple fix.


All times are GMT -5. The time now is 03:05 AM.