When I start a program from desktop (Ubuntu 16.04) instead of from shell so that the program is not associated with a terminal, what are the stdin and stdout for this program? Are STDIN_FILENO
and STDOUT_FILENO
valid file descriptors when the program starts? Where does printf
write to in this case?
You can use the strace
program to see all system calls a program is executing (like open, read, write, close). When you attatch it to the "Desktop program" (the one running your program; use pstree
or proctree
), you can see what happens to file descriptors 0, 1 and 2.
Or google for "gnome run program stdout"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.