接続数

COUNTER379296FROM 2012/5/16

MISRA-C diary(C言語日誌)

MISRA-C >> Article details

2018/04/01

可変数引数

Tweet ThisSend to Facebook | by kaizen
C89(ISO/IEC 9899:1990)では、ライブラリ関数の引数はmain以外に下記。

int fprintf(FILE*streamconstchar*format,...);// 7.9.1
int fscanf(FILE*stream,constchar*format,...);// 7.9.2
int printf(constchar*format,...);// 7.9.3
int scanf(constchar*format,...);// 7.9.4
int sprintf(char*s,constchar*format,...);//7.9.5
int sscanf(constchar*s,constchar*format...);//7.9.6.6 
int vfprintf(FILE*stream,constchar*format,va_listarg);// 7.9.6.7
// = fprintf
int vprintf(constchar*format,va_listarg);// 7.9.6.8
// = printf
int vsprintf(char*s,constchar*format,va_listarg);//7.0.6.9
//= sprintf
                
vfscanf, vscanf, vsscanfがない理由は未調査。



C99(C95(ISO/IEC9899AMD1:1995 ですでに国際化対応でwのついた関数は増えている)

int fprintf(FILE * restrict stream, const char * restrict format, ...); //7.19.6.1

int fscanf(FILE * restrict stream, const char * restrict format, ...);//7.19.6.2
int printf(const char * restrict format, ...);//7.19.6.3

int scanf(const char * restrict format, ...);//7.19.6.4

int snprintf(char * restrict s, size_t n, const char * restrict format, ...);//7.19.6.5

int sprintf(char * restrict s, const char * restrict format, ...);//7.19.6.6

int sscanf(const char * restrict s, const char * restrict format, ...);//7.19.6.7

int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg);//7.19.6.8

int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg);//7.19.6.9

int vprintf(const char * restrict format, va_list arg);//7.19.6.10

int vscanf(const char * restrict format, va_list arg);//7.19.6.11

int vsnprintf(char * restrict s, size_t n, const char * restrict format, va_list arg);//7.19.6.12

int vsprintf(char * restrict s, const char * restrict format, va_list arg);//7.19.6.13

int vsscanf(const char * restrict s, const char * restrict format, va_list arg);//7.19.6.14

int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...);//7.24.2.1
int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...);//7.24.2.2

int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...);//7.24.2.3

int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...);//7.24.2.4

int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);//7.24.2.5

int vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);//7.24.2.6

int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg);//7.24.2.8

int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format,

va_list arg);//7.24.2.9

int vwprintf(const wchar_t * restrict format,

va_list arg);//7.24.2.10

int vwscanf(const wchar_t * restrict format,

va_list arg);//7.24.2.11

int wprintf(const wchar_t * restrict format, ...);//7.24.2.12

int wscanf(const wchar_t * restrict format, ...);//7.24.2.13



C2011

int fprintf(FILE * restrict stream, const char * restrict format, ...);//72.21.6.1

int fscanf(FILE * restrict stream, const char * restrict format, ...);//72.21.6.2

int printf(const char * restrict format, ...);//72.21.6.3

int scanf(const char * restrict format, ...);//72.21.6.4

int snprintf(char * restrict s, size_t n, const char * restrict format, ...);//72.21.6.5

int sprintf(char * restrict s, const char * restrict format, ...);//72.21.6.6

int sscanf(const char * restrict s, const char * restrict format, ...);//72.21.6.7

int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg);//72.21.6.8

int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg);//72.21.6.9

int vprintf(const char * restrict format, va_list arg);//72.21.6.10

int vscanf(const char * restrict format, va_list arg);//72.21.6.1

int vsnprintf(char * restrict s, size_t n, const char * restrict format, va_list arg);//72.21.6.1

int vsprintf(char * restrict s, const char * restrict format, va_list arg);//72.21.6.12

int vsscanf(const char * restrict s, const char * restrict format, va_list arg);//72.21.6.13

int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...);//7.29.2.1

int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...);//7.29.2.2

int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...);//7.29.2.3

int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...);//7.29.2.4

int vfwprintf(FILE * restrict stream, const wchar_t * restrict format,

va_list arg);//7.29.2.5

int vfwscanf(FILE * restrict stream, const wchar_t * restrict format,

va_list arg);//7.29.2.6

int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg);//7.29.2.7

int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format,

va_list arg);//7.29.2.8

int vwprintf(const wchar_t * restrict format, va_list arg);//7.29.2.9

int vwscanf(const wchar_t * restrict format, va_list arg);//7.29.2.10

int wprintf(const wchar_t * restrict format, ...);//7.29.2.11

int wscanf(const wchar_t * restrict format, ...);//7.29.2.12


07:56 | Impressed! | Voted(0) | Comment(0)