Reads formatted input based on an argument list. Format #include <stdio.h> int vfscanf (FILE *file_ptr, const char *format, va_list ap);
1 – Arguments
file_ptr A pointer to the file that provides input text. format A pointer to a string containing the format specification. ap A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.
2 – Description
The vfscanf function is the same as the fscanf function except that instead of being called with a variable number of arguments, it is called with an argument list that has been initialized by va_start (and possibly subsequent va_arg calls). If no conversion specifications are given, you can omit the input pointers. Otherwise, the function calls must have exactly as many input pointers as there are conversion specifications, and the conversion specifications must match the types of the input pointers. Conversion specifications are matched to input sources in left- to-right order. Excess input pointers, if any, are ignored. For more information about format and conversion specifications and their corresponding arguments, see the "Understanding Input and Output" chapter of the VSI C RTL Reference Manual. This function returns the number of successfully matched and assigned input items. See also vscanf and vsscanf.
3 – Return Values
n The number of successfully matched and assigned input items. EOF Indicates that the end-of-file was encountered or a read error occurred. If a read error occurs, the function sets errno to one of the following: o EILSEQ - Invalid character detected. o EINVAL - Insufficient arguments. o ENOMEM - Not enough memory available for conversion. o ERANGE - Floating-point calculations overflow. o EVMSERR - Nontranslatable OpenVMS error. vaxc$errno contains the OpenVMS error code. This can indicate that conversion to a numeric value failed due to overflow. The function can also set errno to the following as a result of errors returned from the I/O subsystem: o EBADF - The file descriptor is not valid. o EIO - I/O error. o ENXIO - Device does not exist. o EPIPE - Broken pipe. o EVMSERR - Nontranslatable OpenVMS error. vaxc$errno contains the OpenVMS error code. This indicates that an I/O error occurred for which there is no equivalent C error code.