[En-Nut-Discussion] freopen(..)

Harald Kipp harald.kipp at egnite.de
Thu Oct 27 15:37:02 CEST 2005


Hi Bernard,

At 11:52 27.10.2005 +0200, you wrote:

>stdout=freopen("uart0","w",stdout);

This is used wrongly. The return value should not be
assigned to stdout, but only checked for failure.



>Now what I want is to use uart0/stdout for debugging and also allow a http 
>client send/receive data to/from uart0.

freopen("uart0","r",stdin);
doesn't work?

It should, but if it's a bug you can still use
fopen() und do debug output via fprintf().


>How should I process that? Use fopen() instead of freopen() ? Can I 
>fopen() twice uart0 without problems? Any hint welcome!

No, you can't open the same device twice. AFAIK, shared
open is not supported.

Harald




More information about the En-Nut-Discussion mailing list