vprintf.3s

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3S 代码 · 共 91 行

3S
91
字号
.\" SCCSID: @(#)vprintf.3s	8.1	9/11/90.TH vprintf 3s.SH Namevprintf, vfprintf, vsprintf \- print formatted output of a varargs argument list.SH Syntax.B "#include <stdio.h>".br.B "#include <varargs.h>".PP.B "int vprintf (format, ap).br.B "char \(**format;".br.B "va_list ap;.PP.B "int vfprintf (stream, format, ap).br.SM.B FILE.B \(**stream;.br.B "char \(**format;".br.B "va_list ap;.PP.B "int vsprintf (s, format, ap).br.B "char \(**s, \(**format;".br.B "va_list ap;.SH Description.NXR "vprintf subroutine".NXR "vfprintf subroutine".NXA "printf subroutine" "vprintf subroutine".NXA "varargs subroutine" "vprintf subroutine".NXR "formatted output" "printing from argument list"The.PN vprintf ,.PN vfprintf ,and.PN vsprintfroutines are the same as.PN printf ,.PN fprintf ,and.PN sprintf ,respectively,except that instead of being called with a variable number of arguments, they are called with an argument list as definedby .MS varargs 3 ..SH Examples.NXR(e) "vprintf subroutine" "writing an error routine and"The following demonstrates how .PN vfprintfcould be usedto write an error routine..EX 0#include <stdio.h>#include <varargs.h>	.	.	./\(** \(**   error should be called like \(**        error(function_name, format, arg1, arg2...); \(**//\(**VARARGS0\(**/voiderror(va_alist)/\(** Note that the function_name and format arguments cannot be \(** separately declared because of the definition of varargs. \(**/va_dcl{    va_list args;    char \(**fmt;    va_start(args);    /\(** print out name of function causing error \(**/    (void)fprintf(stderr, "ERROR in %s: ", va_arg(args, char \(**));    fmt = va_arg(args, char \(**);    /\(** print out remainder of message \(**/    (void)vfprintf(stderr, fmt, args);    va_end(args);    (void)abort( );}.EE.SH See Alsovarargs(3)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?