<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 7 Mar 2008, at 01:41, <a href="mailto:salsaman@xs4all.nl">salsaman@xs4all.nl</a> wrote:</div><blockquote type="cite"><br>something like this (untested, YMMV) should do it:</blockquote><div><br class="webkit-block-placeholder"></div>I think the suggestion of fstat() is better (two filenames under /dev can easily point to the same device nodes, for example), and fstat() is also more portable (should be there on any POSIX compliant system), but if you're first going to dig into /proc:</div><div><br class="webkit-block-placeholder"></div><div><blockquote type="cite">int mypid=(int)getpid();<br>sprintf(string,"/proc/%d/fd/1",mypid);</blockquote><div><br class="webkit-block-placeholder"></div>... this isn't needed - "/proc/self" refers the current process, so you can just use "/proc/self/fd/1" and "/proc/self/fd/2".</div><div><br></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">Vidar</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br class="webkit-block-placeholder"></span></font></div><div><span class="Apple-style-span" style="font-size: 12px; ">-- </span></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Vidar Hokstad</div><div>Technical Director</div><div>Aardvark Media Limited</div><div><div><br></div></div></div></span></div></span></div></span></div></body></html>