_vprintf_p, _vprintf_p_l, _vwprintf_p, _vwprintf_p_l

编写格式化输出使用指针参数列表,并且能够指定参数的顺序。

int _vprintf_p(
   const char *format,
   va_list argptr 
);
int _vprintf_p_l(
   const char *format,
   locale_t locale,
   va_list argptr 
);
int _vwprintf_p(
   const wchar_t *format,
   va_list argptr 
);
int _vwprintf_p_l(
   const wchar_t *format,
   locale_t locale,
   va_list argptr 
);

参数

  • format
    格式规范。

  • argptr
    列表的指针参数。

  • locale
    使用的区域设置。

有关更多信息,请参见 格式规范

返回值

如果输出错误,_vprintf_p 和 _vwprintf_p 返回编写的字符数,不包括终止 null 字符) 或负值。

备注

这些功能中的每一个采用指向参数列表,然后布局和编写特定数据。stdout。 这些函数与 vprintf_s 和 vwprintf_s 唯一不同之处在于它们支持能够指定参数的顺序。 有关更多信息,请参见printf_p位置参数

_vwprintf_p 是 _vprintf_p的宽字符版本;,如果流在 ANSI 模式下,中打开两个函数具有相同的行为。 _vprintf_p 当前不支持输出到 UNICODE 流。

这些功能的版本与 _l 后缀的相同,只不过它们使用区域设置参数而不是当前线程区域设置。

安全说明安全说明

确保 format 不是用户定义的字符串。有关更多信息,请参见 避免缓冲区溢出

如果 format 是 null 指针,或者,如果格式字符串包含无效格式字符,无效参数调用处理程序,如 参数验证所述。 如果执行允许继续,函数返回 -1 并将 errno 到 EINVAL。

一般文本例程映射

TCHAR.H 实例

未定义的_UNICODE & _MBCS

定义的_MBCS

定义的_UNICODE

_vtprintf_p

_vprintf_p

_vprintf_p

_vwprintf_p

_vtprintf_p_l

_vprintf_p_l

_vprintf_p_l

_vwprintf_p_l

要求

实例

必需的标头

选项标头

_vprintf_p, _vprintf_p_l

<stdio.h> 和 <stdarg.h>

<varargs.h>*

_vwprintf_p, _vwprintf_p_l

<stdio.h> 或 <wchar.h>和 <stdarg.h>

<varargs.h>*

*仅对 UNIX v 兼容性。

控件个在 Windows 应用商店 apps 不受支持。 标准流处理与控件个,stdin,stdout和 stderr,在 C 运行时函数在 Windows 应用商店 apps 之前,可以使用它们必须重定向。 有关其他的兼容性信息,请参见中介绍的 兼容性

.NET Framework 等效项

System::Console::Write

请参见

参考

流I/O

vprintf功能

_fprintf_p, _fprintf_p_l, _fwprintf_p, _fwprintf_p_l

_printf_p, _printf_p_l, _wprintf_p, _wprintf_p_l

_sprintf_p, _sprintf_p_l, _swprintf_p, _swprintf_p_l

vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l

va_arg, va_end, va_start

_vfprintf_p, _vfprintf_p_l, _vfwprintf_p, _vfwprintf_p_l

_printf_p, _printf_p_l, _wprintf_p, _wprintf_p_l

printf_p位置参数