stdio.h

Go to the documentation of this file.
00001 #ifndef _STDIO_H
00002 #define _STDIO_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER );
00005 
00006 #include <stdint.h>
00007 #include <stdarg.h>
00008 
00009 extern int __attribute__ (( format ( printf, 1, 2 ) ))
00010 printf ( const char *fmt, ... );
00011 
00012 extern int __attribute__ (( format ( printf, 3, 4 ) ))
00013 snprintf ( char *buf, size_t size, const char *fmt, ... );
00014 
00015 extern int __attribute__ (( format ( printf, 2, 3 ) ))
00016 asprintf ( char **strp, const char *fmt, ... );
00017 
00018 extern int vprintf ( const char *fmt, va_list args );
00019 
00020 extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
00021 
00022 extern int vasprintf ( char **strp, const char *fmt, va_list args );
00023 
00024 /**
00025  * Write a formatted string to a buffer
00026  *
00027  * @v buf               Buffer into which to write the string
00028  * @v fmt               Format string
00029  * @v ...               Arguments corresponding to the format string
00030  * @ret len             Length of formatted string
00031  */
00032 #define sprintf( buf, fmt, ... ) \
00033         snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
00034 
00035 /**
00036  * Write a formatted string to a buffer
00037  *
00038  * @v buf               Buffer into which to write the string
00039  * @v fmt               Format string
00040  * @v args              Arguments corresponding to the format string
00041  * @ret len             Length of formatted string
00042  */
00043 static inline int vsprintf ( char *buf, const char *fmt, va_list args ) {
00044         return vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
00045 }
00046 
00047 #endif /* _STDIO_H */

Generated on Tue Apr 6 20:01:09 2010 for gPXE by  doxygen 1.5.7.1