Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygen_sxprintf.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: GNU GPL, see COPYING in the top level directory 00003 * PROJECT: ReactOS crt library 00004 * FILE: lib/sdk/crt/printf/swprintf.c 00005 * PURPOSE: Implementation of swprintf 00006 * PROGRAMMER: Timo Kreuzer 00007 */ 00008 00009 #include <stdio.h> 00010 #include <stdarg.h> 00011 #include <limits.h> 00012 #include <tchar.h> 00013 00014 #ifdef _UNICODE 00015 #define _tstreamout wstreamout 00016 #else 00017 #define _tstreamout streamout 00018 #endif 00019 00020 int _cdecl _tstreamout(FILE *stream, const TCHAR *format, va_list argptr); 00021 00022 int 00023 #if defined(USER32_WSPRINTF) && defined(_M_IX86) 00024 _stdcall 00025 #else 00026 _cdecl 00027 #endif 00028 _sxprintf( 00029 TCHAR *buffer, 00030 #if USE_COUNT 00031 size_t count, 00032 #endif 00033 const TCHAR *format, 00034 #if USE_VARARGS 00035 va_list argptr) 00036 #else 00037 ...) 00038 #endif 00039 { 00040 #if !USE_VARARGS 00041 va_list argptr; 00042 #endif 00043 int result; 00044 FILE stream; 00045 00046 stream._base = (char*)buffer; 00047 stream._ptr = stream._base; 00048 stream._charbuf = 0; 00049 #if USE_COUNT 00050 stream._cnt = (int)(count * sizeof(TCHAR)); 00051 #else 00052 stream._cnt = INT_MAX; 00053 #endif 00054 stream._bufsiz = 0; 00055 stream._flag = _IOSTRG | _IOWRT; 00056 stream._tmpfname = 0; 00057 00058 #if !USE_VARARGS 00059 va_start(argptr, format); 00060 #endif 00061 result = _tstreamout(&stream, format, argptr); 00062 #if !USE_VARARGS 00063 va_end(argptr); 00064 #endif 00065 00066 /* Only zero terminate if there is enough space left */ 00067 if (stream._cnt >= sizeof(TCHAR)) *(TCHAR*)stream._ptr = _T('\0'); 00068 00069 return result; 00070 } 00071 00072 Generated on Sat May 26 2012 04:35:28 for ReactOS by
1.7.6.1
|