A simple question:
I’m using
system("mkdir /some/dest/");
on my program. How do I disable its output to the screen when running my program because if the dir exists, I get “mkdir: cannot create directory `/some/dest/’: File exists”
Tried to run
system("mkdir /some/dest/ > /dev/null");
but it didn’t work
Thanks
It’s a weird way to create directories from C code, taking into account that
mkdir (1)itself is just a wrapper formkdir (2)system call.I’d recommend using
mkdir (2).P.s. By
(2)I meanmancategory of documentation ($ man 2 mkdir), this is a category for system calls.