This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Change output stream for printf
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Nicolas Brouard <nicolas dot brouard at silicomp dot ca>
- Cc: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Mon, 15 Nov 2004 18:10:36 +0100
- Subject: Re: [ECOS] Change output stream for printf
- References: <MFENKKFPNAKOOKBAEHLHKEHLCEAA.nicolas.brouard@silicomp.ca>
On Mon, Nov 15, 2004 at 11:32:07AM -0500, Nicolas Brouard wrote:
> Hi,
> I would like to change the output stream for printf.
Do you realy mean stream here? If so, than its reasonably easy. Edit
packages/language/c/libc/stdio/current/src/common/stdout.cxx
any replace the libc stream with your stream.
If you don't mean stream here, then it is much more difficult.
> For now, my printf
> function puts characters over serial channel (with tty-mode serial device
> driver on hardware serial device driver).
> I would like printf puts characters over a socket for example.
> How can I change the behaviour of printf?
> I know that I can use diag_init_putc() to do that for diag_printf, but for
> printf?
A quick hack would be to write your own vsnprintf() which called
diag_vsprintf() to do all the work and then write the resulting string
over your socket.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss