mirror of
https://github.com/reactos/reactos.git
synced 2025-06-25 09:49:43 +00:00
Create a branch for header work.
svn path=/branches/header-work/; revision=45691
This commit is contained in:
parent
14fe274b1c
commit
9ea495ba33
19538 changed files with 0 additions and 1063950 deletions
40
lib/sdk/crt/conio/cprintf.c
Normal file
40
lib/sdk/crt/conio/cprintf.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* COPYRIGHT: Winehq
|
||||
* PROJECT: wine
|
||||
* FILE: msvcrt/conio/cprintf.c
|
||||
* PURPOSE: C Runtime
|
||||
* PROGRAMMER: Magnus Olsen (Imported from wine cvs 2006-05-23)
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int
|
||||
_cprintf(const char *fmt, ...)
|
||||
{
|
||||
char buf[2048], *mem = buf;
|
||||
int written, resize = sizeof(buf), retval;
|
||||
va_list valist;
|
||||
|
||||
va_start( valist, fmt );
|
||||
|
||||
while ((written = _vsnprintf( mem, resize, fmt, valist )) == -1 ||
|
||||
written > resize)
|
||||
{
|
||||
resize = (written == -1 ? resize * 2 : written + 1);
|
||||
if (mem != buf)
|
||||
free (mem);
|
||||
if (!(mem = (char *)malloc(resize)))
|
||||
return EOF;
|
||||
|
||||
va_end ( valist );
|
||||
va_start( valist, fmt );
|
||||
}
|
||||
va_end ( valist );
|
||||
retval = _cputs( mem );
|
||||
if (mem != buf)
|
||||
free (mem);
|
||||
return retval;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue