This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Change output stream for printf


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]