sprintf question

Robin Getz rgetz@blackfin.uclinux.org
Thu Mar 1 04:24:00 GMT 2007


On Wed 28 Feb 2007 11:10, Anders Lindgren pondered:
>    There are a bunch of *printf variants in stdlib, so it makes sense to
>  have a single function doing all the (messy!) work and make the others
>  simple wrappers around that function.
>
>     Virtually all stdio implementations I have come across do this the same
>  way[0]: They construct a dummy stdio FILE object with a special flag
>  indicating that it's really just a buffer, and then call vfprintf to do
>  the job. This is a plain dumb convention in many embedded systems, as you
>  have just noticed...

Yeah, I put some stubs in my application,

/* stubs */
int _close(int fd) {}
int _fstat (int filedes, struct stat *buf) {}
int isatty (int desc) {}
off_t _lseek(int fildes, off_t offset, int whence) {}
ssize_t _read(int fd, void *buf, size_t count) {}
ssize_t _write(int fd, const void *buf, size_t count) {}

and it fixed things up. Compiles, and runs without issue now. (It is a little 
stack heavy, but at least it works).

Thanks.

-Robin



More information about the Newlib mailing list