Sample Header Ad - 728x90

How portable are /dev/stdin, /dev/stdout and /dev/stderr?

79 votes
6 answers
25685 views
Occasionally I need to specify a "path-equivalent" of one of the standard IO streams (stdin, stdout, stderr). Since 99% of the time I work with Linux, I just prepend /dev/ to get /dev/stdin, etc., and this "*seems* to do the right thing". But, for one thing, I've always been uneasy about such a rationale (because, of course, "it seems to work" until it doesn't). Furthermore, I have no good sense for how portable this maneuver is. So I have a few questions: 1. In the context of Linux, is it safe (yes/no) to equate stdin, stdout, and stderr with /dev/stdin, /dev/stdout, and /dev/stderr? 2. More generally, is this equivalence "adequately *portable*"? I could not find any POSIX references.
Asked by kjo (16299 rep)
Apr 13, 2012, 10:49 PM
Last activity: Jul 3, 2024, 11:30 PM