int puts(const char *string) { FILE *stream = stdout; if (stream->flag & _IONBF) { char buf[BUFSIZ]; _stbuf(stream, buf, BUFSIZ); while (*string) { if (putchar(*string) == EOF) { _ftbuf(stream); return EOF; } string++; } if (putchar('\n') == EOF) { _ftbuf(stream); return EOF; } _ftbuf(stream); } else { while (*string) { if (putchar(*string) == EOF) return EOF; string++; } if (putchar('\n') == EOF) return EOF; } return 0; }
int __cdecl printf ( const char *format, ... ) /* * stdout 'PRINT', 'F'ormatted */ { va_list arglist; int buffing; int retval; va_start(arglist, format); _ASSERTE(format != NULL); _lock_str2(1, stdout); buffing = _stbuf(stdout); retval = _output(stdout,format,arglist); _ftbuf(buffing, stdout); _unlock_str2(1, stdout); return(retval); }
int __cdecl fwprintf ( FILE *str, const wchar_t *format, ... ) /* * 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted */ { va_list(arglist); REG1 FILE *stream; REG2 int buffing; int retval; // UNDONE: make va_start work with wchar_t format string va_start(arglist, format); _ASSERTE(str != NULL); _ASSERTE(format != NULL); /* Init stream pointer */ stream = str; _lock_str(stream); buffing = _stbuf(stream); retval = _woutput(stream,format,arglist); _ftbuf(buffing, stream); _unlock_str(stream); return(retval); }
int __cdecl vfwprintf_helper ( WOUTPUTFN woutfn, FILE *str, const wchar_t *format, _locale_t plocinfo, va_list ap ) /* * 'V'ariable argument 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted */ { REG1 FILE *stream; REG2 int buffing; REG3 int retval; _VALIDATE_RETURN( (str != NULL), EINVAL, -1); _VALIDATE_RETURN( (format != NULL), EINVAL, -1); /* Init stream pointer */ stream = str; _lock_str(stream); __try { buffing = _stbuf(stream); retval = woutfn(stream,format,plocinfo,ap ); _ftbuf(buffing, stream); } __finally { _unlock_str(stream); } return(retval); }
int __cdecl printf ( const char *format, ... ) /* * stdout 'PRINT', 'F'ormatted */ { va_list arglist; int buffing; int retval = 0; _VALIDATE_RETURN( (format != NULL), EINVAL, -1); va_start(arglist, format); _lock_str2(1, stdout); __try { buffing = _stbuf(stdout); retval = _output_l(stdout,format,NULL,arglist); _ftbuf(buffing, stdout); } __finally { _unlock_str2(1, stdout); } return(retval); }
int __cdecl vfwprintf ( FILE *str, const wchar_t *format, va_list ap ) /* * 'V'ariable argument 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted */ { REG1 FILE *stream; REG2 int buffing; REG3 int retval; _ASSERTE(str != NULL); _ASSERTE(format != NULL); /* Init stream pointer */ stream = str; _lock_str(stream); buffing = _stbuf(stream); retval = _woutput(stream,format,ap ); _ftbuf(buffing, stream); _unlock_str(stream); return(retval); }
int vfprintf(FILE *stream, const char *fmt, va_list args) { int rc; if (stream->flag & _IONBF) { char buf[BUFSIZ]; _stbuf(stream, buf, BUFSIZ); rc = _output(stream, fmt, args); _ftbuf(stream); } else { rc = _output(stream, fmt, args); } return rc; }
int fputs(const char *string, FILE *stream) { int len; int written; len = strlen(string); if (stream->flag & _IONBF) { char buf[BUFSIZ]; _stbuf(stream, buf, BUFSIZ); written = fwrite(string, 1, len, stream); _ftbuf(stream); } else { written = fwrite(string, 1, len, stream); } return written == len ? 0 : EOF; }
int __cdecl _putts ( const _TCHAR *string ) { int buffing; #ifndef _UNICODE unsigned int length; unsigned int ndone; #endif /* _UNICODE */ int retval = _TEOF; /* error */ _ASSERTE(string != NULL); _lock_str2(1, stdout); buffing = _stbuf(stdout); #ifdef _UNICODE while (*string) { if (_putwchar_lk(*string++) == WEOF) goto done; } if (_putwchar_lk(L'\n') != WEOF) retval = 0; /* success */ #else /* _UNICODE */ length = strlen(string); ndone = _fwrite_lk(string,1,length,stdout); if (ndone == length) { _putc_lk('\n',stdout); retval = 0; /* success */ } #endif /* _UNICODE */ #ifdef _UNICODE done: #endif /* _UNICODE */ _ftbuf(buffing, stdout); _unlock_str2(1, stdout); return retval; }
int __cdecl fputs ( const char *string, FILE *stream ) { REG2 int buffing; REG1 unsigned int length; REG3 unsigned int ndone; _ASSERTE(string != NULL); _ASSERTE(stream != NULL); length = strlen(string); _lock_str(stream); buffing = _stbuf(stream); ndone = _fwrite_lk(string,1,length,stream); _ftbuf(buffing, stream); _unlock_str(stream); return(ndone == length ? 0 : EOF); }
int __cdecl vwprintf ( const wchar_t *format, va_list ap ) /* * stdout 'V'ariable, 'W'char_t 'PRINT', 'F'ormatted */ { REG1 FILE *stream = stdout; REG2 int buffing; REG3 int retval; _ASSERTE(format != NULL); _lock_str(stream); buffing = _stbuf(stream); retval = _woutput(stream, format, ap ); _ftbuf(buffing, stream); _unlock_str(stream); return(retval); }
int __cdecl fprintf ( FILE *str, const char *format, ... ) /* * 'F'ile (stream) 'PRINT', 'F'ormatted */ { va_list(arglist); FILE *stream; int buffing; int retval=0; _VALIDATE_RETURN( (str != NULL), EINVAL, -1); _VALIDATE_RETURN( (format != NULL), EINVAL, -1); va_start(arglist, format); /* Init stream pointer */ stream = str; _lock_str(stream); __try { _VALIDATE_STREAM_ANSI_SETRET(stream, EINVAL, retval, -1); if (retval==0) { buffing = _stbuf(stream); retval = _output_l(stream,format,NULL,arglist); _ftbuf(buffing, stream); } } __finally { _unlock_str(stream); } return(retval); }
int __cdecl fputs( const char* string, FILE* stream ) { REG2 int buffing; REG1 size_t length; REG3 size_t ndone; _VALIDATE_RETURN((string != NULL), EINVAL, EOF); _VALIDATE_RETURN((stream != NULL), EINVAL, EOF); _VALIDATE_STREAM_ANSI_RETURN(stream, EINVAL, EOF); length = strlen(string); _lock_str(stream); __try { buffing = _stbuf(stream); ndone = _fwrite_nolock(string, 1, length, stream); _ftbuf(buffing, stream); } __finally { _unlock_str(stream); } return (ndone == length ? 0 : EOF); }
int __cdecl fwprintf ( FILE *str, const wchar_t *format, ... ) /* * 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted */ { va_list(arglist); REG1 FILE *stream; REG2 int buffing; int retval; _VALIDATE_RETURN( (str != NULL), EINVAL, -1); _VALIDATE_RETURN( (format != NULL), EINVAL, -1); va_start(arglist, format); /* Init stream pointer */ stream = str; _lock_str(stream); __try { buffing = _stbuf(stream); retval = _woutput_l(stream,format,NULL,arglist); _ftbuf(buffing, stream); } __finally { _unlock_str(stream); } return(retval); }