4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Macros, types, and functions for performing I/O.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The following functions are declared in this file:<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync@verbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### Operations on files. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int remove (const char *FileName);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int rename (const char *, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *tmpfile (void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *tmpnam (char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### File access functions. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fclose (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fflush (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *fopen (const char * __restrict ,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *freopen (const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, FILE * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void setbuf (FILE * __restrict, char * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int setvbuf (FILE * __restrict, char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int, size_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### Formatted Input/Output Functions. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fprintf (FILE * __restrict stream,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fscanf (FILE * __restrict, const char * __restrict, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int printf (const char * __restrict, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int scanf (const char * __restrict, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int sprintf (char * __restrict, const char * __restrict, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int sscanf (const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vfprintf (FILE * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vprintf (const char * __restrict, va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vsprintf (char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### Character Input/Output Functions. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fgetc (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *fgets (char * __restrict, int, FILE * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fputc (int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fputs (const char * __restrict, FILE * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int getc (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int getchar (void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *gets (char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int putc (int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int putchar (int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int puts (const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int ungetc (int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### Direct Input/Output Functions. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t fread (void * __restrict, size_t, size_t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t fwrite (const void * __restrict, size_t, size_t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### File Positioning Functions. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fgetpos (FILE * __restrict, fpos_t * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fseek (FILE *, long, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fsetpos (FILE *, const fpos_t *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync long ftell (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void rewind (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### Error-handling Functions. ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void clearerr (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int feof (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int ferror (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void perror (const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################### Functions NOT specified by C95 ####
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *fdopen (int, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void flockfile (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int ftrylockfile (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void funlockfile (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int getc_unlocked (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int getchar_unlocked(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int putc_unlocked (int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int putchar_unlocked(int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int pclose (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *popen (const char *, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int snprintf (char * __restrict, size_t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vsnprintf (char * __restrict, size_t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *mkdtemp (char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int mkstemp (char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *mktemp (char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *tempnam (const char *, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fseeko (FILE *, off_t, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *fgetln (FILE * __restrict, size_t * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *fparseln (FILE *, size_t *, size_t *, const char[3], int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fpurge (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void setbuffer (FILE *, char *, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int setlinebuf (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vasprintf (char ** __restrict, const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vscanf (const char * __restrict, va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vsscanf (const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char * __restrict, va_list);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync@endverbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @note To fit things in six character monocase externals, the stdio
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync code uses the prefix `__s' for stdio objects, typically followed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by a three-character attempt at a mnemonic.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This program and the accompanying materials are licensed and made available under
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the terms and conditions of the BSD License that accompanies this distribution.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync http://opensource.org/licenses/bsd-license.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright (c) 1990, 1993
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The Regents of the University of California. All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This code is derived from software contributed to Berkeley by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Chris Torek.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Redistribution and use in source and binary forms, with or without
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * modification, are permitted provided that the following conditions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * are met:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 1. Redistributions of source code must retain the above copyright
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notice, this list of conditions and the following disclaimer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 2. Redistributions in binary form must reproduce the above copyright
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notice, this list of conditions and the following disclaimer in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * documentation and/or other materials provided with the distribution.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * 3. Neither the name of the University nor the names of its contributors
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * may be used to endorse or promote products derived from this software
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * without specific prior written permission.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * SUCH DAMAGE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * @(#)stdio.h 8.5 (Berkeley) 4/29/95
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync NetBSD: stdio.h,v 1.66.2.3 2007/08/24 20:07:38 liamjfoy Exp
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef _STDIO_H_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define _STDIO_H_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <stdarg.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <limits.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <sys/ansi.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <machine/ansi.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifdef _EFI_SIZE_T_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /** size_t is the unsigned integer type of the result of the sizeof operator. **/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync typedef _EFI_SIZE_T_ size_t;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #undef _EFI_SIZE_T_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #undef _BSD_SIZE_T_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync An object type capable of holding all information necessary to specify any
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync position within a file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Each wide-oriented stream has an associated mbstate_t object that stores the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync current parse state of the stream. A successful call to fgetpos stores a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync representation of the value of this mbstate_t object as part of the value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync of the fpos_t object. A later successful call to fsetpos using the same
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stored fpos_t value restores the value of the associated mbstate_t object
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as well as the position within the controlled stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This is fairly grotesque, but pure ANSI code must not inspect the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync innards of an fpos_t anyway. The library internally uses off_t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which we assume is exactly as big as eight chars.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#if (!defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)) || defined(_LIBC)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef __off_t fpos_t;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef struct __sfpos {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __off_t _pos;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync} fpos_t;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*@}*/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* stdio buffers */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncstruct __sbuf {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char *_base;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int _size;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync};
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Structure which holds all the information needed to control a stream or file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The following always hold:<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * - if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * - _lbfsize is -_bf._size, else _lbfsize is 0
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * - if _flags&__SRD, _w is 0
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * - if _flags&__SWR, _r is 0
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This ensures that the getc and putc macros (or inline functions) never
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * try to write or read from a file that is in `read' or `write' mode.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * (Moreover, they can, and do, automatically switch from read mode to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * write mode, and back, on "r+" and "w+" files.)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * _lbfsize is used only to make the inline line-buffered output stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * code as compact as possible.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * _ub, _up, and _ur are used when ungetc() pushes back more characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * than fit in the current _bf, or when ungetc() pushes back a character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * that does not match the previous one in _bf. When this happens,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef struct __sFILE {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char *_p; /**< current position in (some) buffer */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int _r; /**< read space left for getc() */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int _w; /**< write space left for putc() */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned short _flags; /**< flags, below; this FILE is free if 0 */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync short _file; /**< fileno, if Unix descriptor, else -1 */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync struct __sbuf _bf; /**< the buffer (at least 1 byte, if !NULL) */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int _lbfsize; /**< 0 or -_bf._size, for inline putc */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* operations */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *_cookie; /**< cookie passed to io functions */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*_close)(void *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*_read) (void *, char *, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fpos_t (*_seek) (void *, fpos_t, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*_write)(void *, const char *, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /** file extension */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync struct __sbuf _ext;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /** @{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Separate buffer for long sequences of ungetc().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync **/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char *_up; /**< saved _p when _p is doing ungetc data */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int _ur; /**< saved _r when _r is counting ungetc data */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /*@}*/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* tricks to meet minimum requirements even when malloc() fails */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char _ubuf[3]; /**< guarantee an ungetc() buffer */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char _nbuf[1]; /**< guarantee a getc() buffer */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /** separate buffer for fgetln() when line crosses buffer boundary */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync struct __sbuf _lb; /* buffer for fgetln() */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* Unix stdio files get aligned to block boundaries on fseek() */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int _blksize; /**< stat.st_blksize (may be != _bf._size) */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fpos_t _offset; /**< current lseek offset */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync} FILE;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern FILE __sF[];
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SLBF 0x0001 /**< line buffered */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SNBF 0x0002 /**< unbuffered */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SRD 0x0004 /**< OK to read */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SWR 0x0008 /**< OK to write */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* RD and WR are never simultaneously asserted */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SRW 0x0010 /**< open for reading & writing */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SEOF 0x0020 /**< found EOF */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SERR 0x0040 /**< found error */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SMBF 0x0080 /**< _buf is from malloc */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SAPP 0x0100 /**< fdopen()ed in append mode */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SSTR 0x0200 /**< this is an sprintf/snprintf string */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SOPT 0x0400 /**< do fseek() optimization */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SNPT 0x0800 /**< do not do fseek() optimization */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SOFF 0x1000 /**< set iff _offset is in fact correct */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SMOD 0x2000 /**< true => fgetln modified _p text */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SALC 0x4000 /**< allocate string space dynamically */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* The following three definitions are for ANSI C, which took them
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync from System V, which brilliantly took internal interface macros and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync made them official arguments to setvbuf(), without renaming them.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Hence, these ugly _IOxxx names are *supposed* to appear in user code.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Although numbered as their counterparts above, the implementation
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync does not rely on this.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define _IOFBF 0 /**< setvbuf should set fully buffered */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define _IOLBF 1 /**< setvbuf should set line buffered */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define _IONBF 2 /**< setvbuf should set unbuffered */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define BUFSIZ 1024 /**< size of buffer used by setbuf */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define EOF (-1) /**< A constant integer expression indicating end-of-file. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** FOPEN_MAX is a minimum maximum, and is the number of streams that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stdio can provide without attempting to allocate further resources
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (which could fail). Do not use this for anything.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FOPEN_MAX OPEN_MAX /* must be <= OPEN_MAX <sys/syslimits.h> */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Size needed for an array of char large enough to hold the longest file name string. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FILENAME_MAX PATH_MAX /* must be <= PATH_MAX <sys/syslimits.h> */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Size needed for an array of char large enough to hold the file name string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync generated by the tmpname() function.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define L_tmpnam PATH_MAX /* must be == PATH_MAX */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef TMP_MAX
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define TMP_MAX 308915776 /**< The maximum number of unique file names
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync that can be generated by tmpnam(). **/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Always ensure that these are consistent with <fcntl.h>! */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef SEEK_SET
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define SEEK_SET 0 /**< set file offset to offset */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef SEEK_CUR
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define SEEK_CUR 1 /**< set file offset to current plus offset */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef SEEK_END
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define SEEK_END 2 /**< set file offset to EOF plus offset */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define stdin (&__sF[0]) /**< FILE reference for the STanDard INput stream. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define stdout (&__sF[1]) /**< FILE reference for the STanDard OUTput stream. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define stderr (&__sF[2]) /**< FILE reference for the STanDard ERRor stream. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Functions defined in C95 standard. ###################################### */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Operations on files. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Remove (delete) a file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] FileName The path to the file to be removed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Zero The operation succeeded.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Non-zero The operation failed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint remove (const char *FileName);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Rename the file named OldName to NewName.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] OldName The name of the existing file to be renamed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] NewName The new name of the file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Zero The operation succeeded.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Non-zero The operation failed. OldName still exists and has been unmodified.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If OldName does not exist, or a file named NewName already exists,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync rename() will fail are return a non-zero value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint rename (const char *OldName, const char *NewName);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Create a guaranteed unique temporary file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A binary file is created in the _PATH_TMP directory that is guaranteed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync have a unique name. The file will be open for update with mode "wb+" and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync its FILE pointer returned upon successfull completion. When the file is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync closed, or when the creating program terminates, the file will be removed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval NULL The temporary file could not be created.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval non-NULL The returned value is a pointer to the FILE object
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync associated with the newly created and open temporary file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncFILE *tmpfile (void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Generate a string that is a valid file name, in the _PATH_TMP directory, that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is not the same as the name of an existing file. The function can potentially
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync generate up to TMP_MAX different strings.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buffer A pointer to an array of at least L_tmpnam char elements.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or NULL. If non-NULL, the tmpnam function writes its
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync result into that array and returns the argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as its value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If no suitable string can be generated a NULL pointer is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Otherwise, if Buffer is NULL, the result is produced in an internal
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync static object and a pointer to that object is returned. If Buffer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is non-null, the results are written into the array pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Buffer and Buffer is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *tmpnam (char *Buffer);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ File access functions. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Close the open stream, specified by fp, and de-associate it from any file or device.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] fp Pointer to a stream object, of type FILE, associated with a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync file or device.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Zero The stream was successfully closed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Non-zero There was an error closing the stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fclose (FILE *fp);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Empties any buffers associated with the stream specified by fp.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] fp Pointer to a stream object, of type FILE, associated with a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync file or device.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Zero The stream's buffers were successfully emptied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EOF There was an error writing to the stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fflush (FILE *fp);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Associates a file, named by Path, with a stream and prepares it for subsequent
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The parameter Mode points to a string specifying behavior characteristics for
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the opened file. The recognized Mode strings are:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - r Open text file for reading.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - w Truncate file to zero length or create text file for writing.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - a Open or create a text file for writing at end-of-file (append).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - rb Open binary file for reading.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - wb Truncate file to zero length or create binary file for writing.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - ab Open or create a binary file for writing at end-of-file (append).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - r+ Open text file for update (reading and writing).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - w+ Truncate file to zero length or create text file for update.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - a+ Open or create a text file for update, writing at end-of-file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - r+b or rb+ Open binary file for update (reading and writing).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - w+b or wb+ Truncate file to zero length or create binary file for update.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - a+b or ab+ Open or create a binary file for update, writing at end-of-file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Opening a file with read mode fails if the file does not exist.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Opening a file with append mode causes all writes to the file to be forced to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the current end-of-file, regardless of any intervening calls to fseek.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Path The path or name of the file or device to open.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Mode The mode in which the file is to be opened.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return A pointer to a FILE object associated with the opened file is returned
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if the file was opened successfully. Otherwise, NULL is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncFILE *fopen (const char * __restrict Path, const char * __restrict Mode);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Closes the file associated with Ofp then opens the file specified by Path and associates it with
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream Ofp.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Any errors that occur when closing Ofp are ignored. The file specified by Path is opened with mode Mode
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and associated with stream Ofp instead of producing a new stream object.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Path is NULL, the mode of the file associated with Ofp is changed to Mode.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Path The path or name of the file or device to open.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Mode The mode in which the file is to be opened.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Ofp Pointer to the FILE object to be closed and associated with the new file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If Path was not able to be opened, or the mode changed, NULL is returned;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync otherwise Ofp is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncFILE *freopen (const char * __restrict Path, const char * __restrict Mode, FILE * __restrict Ofp);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Establishes Fully Buffered or Non-buffered mode for a stream, fp, using Buff as the buffer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The file associated with fp must have been successfully opened with no operations, other than
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync possibly an unsuccessful call to setvbuf, performed prior to the call to setbuf.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Buff is non-NULL, the stream associated with fp is set to Fully Buffered mode using the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync array pointed to by Buff as the buffer. The buffer is assumed to be BUFSIZ char long.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This is equivalent to calling setvbuf(fp, Buff, _IOFBF, BUFSIZ);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Buff is NULL, stream fp is set to Non-buffered mode.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This is equivalent to calling setvbuf(fp, NULL, _IONBF, 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] fp Pointer to the FILE object which will have its buffer set.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Buff The buffer to use for fp, or NULL.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid setbuf (FILE * __restrict fp, char * __restrict Buff);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Establishes a buffering mode and buffer for use by operations performed on the file associated with fp.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The file associated with fp must have been successfully opened with no operations, other than
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync possibly an unsuccessful call to setvbuf, performed prior to the call to setbuf.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Parameter BufMode determines how stream fp will be buffered:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - _IOFBF causes I/O to be fully buffered.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - _IOLBF causes I/O to be line buffered.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - _IONBF causes I/O to be unbuffered.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Buff is not NULL, it points to an array to be used as an I/O buffer for stream fp. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync buffer is set to BufSize char in length. Otherwise, an array of BufSize char is allocated
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by the setvbuf function if BufMode is not _IONBF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync It is an error for BufSize to be zero unless BufMode is _IONBF, in which case BufSize is ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] fp Pointer to the FILE object which will have its buffer set.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Buff The buffer to use for fp, or NULL.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] BufMode The buffering mode to use.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] BufSize The size of the buffer to use, specified in char.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Zero The buffer and mode were established successfully.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Non-zero The request can not be honored, or an invalid value for BufMode was given.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint setvbuf (FILE * __restrict fp, char * __restrict Buff, int BufMode, size_t BufSize);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Formatted Input/Output Functions. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The fprintf function writes output to the stream pointed to by stream,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync under control of the string pointed to by format that specifies how
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync subsequent arguments are converted for output. If there are insufficient
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync arguments for the format, the behavior is indeterminate. If the format is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync exhausted while arguments remain, the excess arguments are evaluated
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (as always) but are otherwise ignored. The fprintf function returns when
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the end of the format string is encountered.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The format is interpreted as a multibyte character sequence, beginning and ending
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in its initial shift state. The format is composed of zero or more directives:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ordinary multibyte characters (not %), which are copied unchanged to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync output stream; and conversion specifications, each of which results in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fetching zero or more subsequent arguments, converting them, if applicable,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync according to the corresponding conversion specifier, and then writing the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync result to the output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Each conversion specification is introduced by the character %. After
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the %, the following appear in sequence:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - Zero or more flags (in any order) that modify the meaning of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversion specification.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - An optional minimum field width. If the converted value has fewer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters than the field width, it is padded with spaces (by default)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync on the left (or right, if the left adjustment flag, described later,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync has been given) to the field width. The field width takes the form of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an asterisk * (described later) or a nonnegative decimal integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - An optional precision that gives the minimum number of digits to appear
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync for the d, i, o, u, x, and X conversions, the number of digits to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync appear after the decimal-point character for e, E, f, and F
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversions, the maximum number of significant digits for the g and G
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversions, or the maximum number of bytes to be written for s
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversions. The precision takes the form of a period (.) followed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync either by an asterisk * (described later) or by an optional decimal
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync integer; if only the period is specified, the precision is taken as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync zero. If a precision appears with any other conversion specifier, it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - An optional length modifier that specifies the size of the argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - A conversion specifier character that specifies the type of conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be applied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync As noted above, a field width, or precision, or both, may be indicated by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an asterisk. In this case, an int argument supplies the field width or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision. The arguments specifying field width, or precision, or both, shall
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync appear (in that order) before the argument (if any) to be converted. A negative
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync field width argument is taken as a - flag followed by a positive field width.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A negative precision argument is interpreted as if the precision were omitted.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The flag characters and their meanings are:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - The result of the conversion is left-justified within the field.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (It is right-justified if this flag is not specified.)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync + The result of a signed conversion always begins with a plus or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync minus sign. (It begins with a sign only when a negative value is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted if this flag is not specified.)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync space If the first character of a signed conversion is not a sign, or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if a signed conversion results in no characters, a space is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync prefixed to the result. If the space and + flags both appear, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync space flag is ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync # The result is converted to an "alternative form".
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - For o conversion, it increases the precision, if and only if necessary,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to force the first digit of the result to be a zero (if the value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and precision are both 0, a single 0 is printed).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - For e, E, f, F, g, and G conversions, the result of converting a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync floating-point number always contains a decimal-point character,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync even if no digits follow it. (Normally, a decimal-point character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync appears in the result of these conversions only if a digit follows
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync it.)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - For g and G conversions, trailing zeros are not removed from
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the result. For other conversions, it is ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync 0 For d, i, o, u, x, X, e, E, f, F, g, and G conversions, leading
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync zeros (following any indication of sign or base) are used to pad to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the field width rather than performing space padding, except when
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converting an infinity or NaN. If the 0 and - flags both appear,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the 0 flag is ignored. For d, i, o, u, x, and X conversions, if a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision is specified, the 0 flag is ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The length modifiers and their meanings are:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync hh Specifies that a following d, i, o, u, x, or X conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to a signed char or unsigned char argument (the argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync will have been promoted according to the integer promotions, but
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync its value shall be converted to signed char or unsigned char before
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync printing); or that a following n conversion specifier applies to a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to a signed char argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync h Specifies that a following d, i, o, u, x, or X conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to a short int or unsigned short int argument (the argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync will have been promoted according to the integer promotions, but
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync its value shall be converted to short int or unsigned short int
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync before printing); or that a following n conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to a pointer to a short int argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync l (ell) Specifies that a following d, i, o, u, x, or X conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to a long int or unsigned long int argument; that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a following n conversion specifier applies to a pointer to a long
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int argument; that a following c conversion specifier applies to a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync wint_t argument; that a following s conversion specifier applies to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a pointer to a wchar_t argument; or has no effect on a following e,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync E, f, F, g, or G conversion specifier.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to a long long int or unsigned long long int
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument; or that a following n conversion specifier applies to a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to a long long int argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync j Specifies that a following d, i, o, u, x, or X conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to an intmax_t or uintmax_t argument; or that a following n
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversion specifier applies to a pointer to an intmax_t argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync z Specifies that a following d, i, o, u, x, or X conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to a size_t or the corresponding signed integer type
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument; or that a following n conversion specifier applies to a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to a signed integer type corresponding to size_t argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync t Specifies that a following d, i, o, u, x, or X conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to a ptrdiff_t or the corresponding unsigned integer type
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument; or that a following n conversion specifier applies to a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to a ptrdiff_t argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync L Specifies that a following e, E, f, F, g, or G conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync applies to a long double argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If a length modifier appears with any conversion specifier other than as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specified above, it is ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The conversion specifiers and their meanings are:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync d,i The int argument is converted to signed decimal in the style
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync [-]dddd. The precision specifies the minimum number of digits to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync appear; if the value being converted can be represented in fewer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync digits, it is expanded with leading zeros. The default precision
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is 1. The result of converting a zero value with a precision of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync zero is no characters.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync o,u,x,X The unsigned int argument is converted to unsigned octal (o),
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned decimal (u), or unsigned hexadecimal notation (x or X) in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the style dddd; the letters abcdef are used for x conversion and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the letters ABCDEF for X conversion. The precision specifies the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync minimum number of digits to appear; if the value being converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync can be represented in fewer digits, it is expanded with leading
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync zeros. The default precision is 1. The result of converting a zero
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync value with a precision of zero is no characters.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync f,F A double argument representing a floating-point number is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted to decimal notation in the style [-]ddd.ddd, where the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync number of digits after the decimal-point character is equal to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision specification. If the precision is missing, it is taken
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as 6; if the precision is zero and the # flag is not specified, no
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync decimal-point character appears. If a decimal-point character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync appears, at least one digit appears before it. The value is rounded
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to the appropriate number of digits.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A double argument representing an infinity is converted in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the style [-]inf. A double argument representing a NaN is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted in the style [-]nan. The F conversion specifier produces INF,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync INFINITY, or NAN instead of inf, infinity, or nan, respectively.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync e,E A double argument representing a floating-point number is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted in the style [-]d.ddd e[+-]dd, where there is one digit
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (which is nonzero if the argument is nonzero) before the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync decimal-point character and the number of digits after it is equal
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to the precision; if the precision is missing, it is taken as 6; if
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the precision is zero and the # flag is not specified, no
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync decimal-point character appears. The value is rounded to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync appropriate number of digits. The E conversion specifier produces a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync number with E instead of e introducing the exponent. The exponent
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync always contains at least two digits, and only as many more digits
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as necessary to represent the exponent. If the value is zero, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync exponent is zero.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A double argument representing an infinity or NaN is converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the style of an f or F conversion specifier.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync g,G A double argument representing a floating-point number is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted in style f or e (or in style F or E in the case of a G
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversion specifier), depending on the value converted and the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision. Let P equal the precision if nonzero, 6 if the precision
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is omitted, or 1 if the precision is zero. Then, if a conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync with style E would have an exponent of X:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - if P > X = -4, the conversion is with style f (or F) and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision P - (X + 1).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - otherwise, the conversion is with style e (or E) and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision P - 1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Finally, unless the # flag is used, any trailing zeros are removed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync from the fractional portion of the result and the decimal-point
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character is removed if there is no fractional portion remaining.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A double argument representing an infinity or NaN is converted in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the style of an f or F conversion specifier.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync c If no l length modifier is present, the int argument is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted to an unsigned char, and the resulting character is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync written. If an l length modifier is present, the wint_t argument is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted as if by an ls conversion specification with no precision
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and an argument that points to the initial element of a two-element
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync array of wchar_t, the first element containing the wint_t argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to the lc conversion specification and the second a null wide
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync s If no l length modifier is present, the argument is a pointer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to the initial element of an array of character type. Characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync from the array are written up to (but not including) the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null character. If the precision is specified, no more
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync than that many bytes are written. If the precision is not specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or is greater than the size of the array, the array shall contain a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync null character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If an l length modifier is present, the argument shall be a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to the initial element of an array of wchar_t type. Wide
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters from the array are converted to multibyte characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (each as if by a call to the wcrtomb function, with the conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync state described by an mbstate_t object initialized to zero before
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the first wide character is converted) up to and including a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null wide character. The resulting multibyte characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync are written up to (but not including) the terminating null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character (byte). If no precision is specified, the array shall
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contain a null wide character. If a precision is specified, no more
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync than that many bytes are written (including shift sequences, if
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync any), and the array shall contain a null wide character if, to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync equal the multibyte character sequence length given by the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precision, the function would need to access a wide character one
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync past the end of the array. In no case is a partial multibyte
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character written.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync p The argument shall be a pointer to void. The value of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer is converted to a sequence of printing characters.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync n The argument shall be a pointer to signed integer into which is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync written the number of characters written to the output stream so
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync far by this call to fprintf. No argument is converted, but one is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync consumed. If the conversion specification includes any flags, a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync field width, or a precision, they will be ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync % A % character is written. No argument is converted. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync complete conversion specification shall be %%.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync In no case does a nonexistent or small field width cause truncation of a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync field; if the result of a conversion is wider than the field width, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync field is expanded to contain the conversion result.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] stream An open File specifier to which the output is sent.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be copied unchanged, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ... Variable number of parameters as required by format.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fprintf function returns the number of characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transmitted, or a negative value if an output or encoding
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error occurred.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fprintf (FILE * __restrict stream, const char * __restrict format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Reads characters from stream, under control of format, storing the converted values
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in variables pointed to by the variable-length parameter list.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The format is interpreted as a multibyte character sequence, beginning and ending
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in its initial shift state. The format is composed of zero or more directives:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync one or more white-space characters, an ordinary multibyte character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (neither % nor a white-space character), or a conversion specification.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Each conversion specification is introduced by the character %. After
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the %, the following appear in sequence:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - An optional assignment-suppressing character, *.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - An optional decimal integer, greater than zero, that specifies the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync maximum field width (in characters).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - An optional length modifier that specifies the size of the receiving object.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - A conversion specifier character that specifies the type of conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be applied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fscanf function executes each directive of the format in turn. If a directive fails, as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync detailed below, the function returns. Failures are described as input failures (due to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync occurrence of an encoding error or the unavailability of input characters), or matching
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync failures (due to inappropriate input).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A directive composed of white-space character(s) is executed by reading input up to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync first non-white-space character (which remains unread), or until no more characters can
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync be read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A directive that is an ordinary multibyte character is executed by reading the next
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters of the stream. If any of those characters differ from the ones composing the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync directive, the directive fails and the differing and subsequent characters remain unread.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync read, the directive fails.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The length modifiers and their meanings are:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - hh Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to signed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char or unsigned char.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - h Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to short
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int or unsigned short int.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - l (ell) Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync long int or unsigned long int; that a following a, A, e,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync E, f, F, g, or G conversion specifier applies to an
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument with type pointer to double; or that a following
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync c, s, or [ conversion specifier applies to an argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync with type pointer to wchar_t.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync long long int or unsigned long long int.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - j Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync intmax_t or uintmax_t.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - z Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t or the corresponding signed integer type.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - t Specifies that a following d, i, o, u, x, X, or n conversion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifier applies to an argument with type pointer to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ptrdiff_t or the corresponding unsigned integer type.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - L Specifies that a following e, E, f, F, g, or G
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync conversion specifier applies to an argument with type
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to long double.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If a length modifier appears with any conversion specifier other than as specified above,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync it will be ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The conversion specifiers and their meanings are:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - d Matches an optionally signed decimal integer, whose format is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the same as expected for the subject sequence of the strtol
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function with the value 10 for the base argument. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync corresponding argument shall be a pointer to signed integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - i Matches an optionally signed integer, whose format is the same
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as expected for the subject sequence of the strtol function
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync with the value 0 for the base argument. The corresponding
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument shall be a pointer to signed integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - o Matches an optionally signed octal integer, whose format is the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync same as expected for the subject sequence of the strtoul
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function with the value 8 for the base argument. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync corresponding argument shall be a pointer to unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - u Matches an optionally signed decimal integer, whose format is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the same as expected for the subject sequence of the strtoul
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function with the value 10 for the base argument. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync corresponding argument shall be a pointer to unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - x Matches an optionally signed hexadecimal integer, whose format
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is the same as expected for the subject sequence of the strtoul
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function with the value 16 for the base argument. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync corresponding argument shall be a pointer to unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - e,f,g Matches an optionally signed floating-point number, infinity,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or NaN, whose format is the same as expected for the subject
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync sequence of the strtod function. The corresponding argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shall be a pointer to floating.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - c Matches a sequence of characters of exactly the number
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specified by the field width (1 if no field width is present
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the directive). If no l length modifier is present, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync corresponding argument shall be a pointer to the initial
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync element of a character array large enough to accept the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync sequence. No null character is added.<BR><BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If an l length modifier is present, the input shall be a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync sequence of multibyte characters that begins in the initial
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shift state. Each multibyte character in the sequence is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted to a wide character as if by a call to the mbrtowc
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function, with the conversion state described by an mbstate_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync object initialized to zero before the first multibyte character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is converted. The corresponding argument shall be a pointer to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the initial element of an array of wchar_t large enough to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync accept the resulting sequence of wide characters. No null wide
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character is added.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - s Matches a sequence of non-white-space characters.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If no l length modifier is present, the corresponding argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shall be a pointer to the initial element of a character array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync large enough to accept the sequence and a terminating null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character, which will be added automatically. If an l length
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync modifier is present, the input shall be a sequence of multibyte
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters that begins in the initial shift state. Each
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync multibyte character is converted to a wide character as if by a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync call to the mbrtowc function, with the conversion state
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync described by an mbstate_t object initialized to zero before the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync first multibyte character is converted. The corresponding
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument shall be a pointer to the initial element of an array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync of wchar_t large enough to accept the sequence and the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null wide character, which will be added automatically.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - [ Matches a nonempty sequence of characters from a set of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync expected characters (the scanset).<BR><BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If no l length modifier is present, the corresponding argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync shall be a pointer to the initial element of a character array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync large enough to accept the sequence and a terminating null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character, which will be added automatically. If an l length
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync modifier is present, the input shall be a sequence of multibyte
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters that begins in the initial shift state. Each
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync multibyte character is converted to a wide character as if by a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync call to the mbrtowc function, with the conversion state
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync described by an mbstate_t object initialized to zero before the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync first multibyte character is converted. The corresponding
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument shall be a pointer to the initial element of an array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync of wchar_t large enough to accept the sequence and the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null wide character, which will be added
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync automatically.<BR><BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The conversion specifier includes all subsequent characters in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the format string, up to and including the matching right
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync bracket (]). The characters between the brackets (the scanlist)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync compose the scanset, unless the character after the left
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync bracket is a circumflex (^), in which case the scanset contains
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync all characters that do not appear in the scanlist between the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync circumflex and the right bracket. If the conversion specifier
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync begins with [] or [^], the right bracket character is in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync scanlist and the next following right bracket character is the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync matching right bracket that ends the specification; otherwise
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the first following right bracket character is the one that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ends the specification. If a - character is in the scanlist and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is not the first, nor the second where the first character is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a ^, nor the last character, it will be treated as a regular character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - p Matches a set of sequences, which are the same as the set of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync sequences that are produced by the %p conversion of the fprintf
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function. The corresponding argument must be a pointer to a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to void. The input item is converted to a pointer value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If the input item is a value converted earlier during the same
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync program execution, the pointer that results will compare equal
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to that value; otherwise the behavior of the %p conversion is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indeterminate.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - n No input is consumed. The corresponding argument shall be a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer to signed integer into which is to be written the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync number of characters read from the input stream so far by this
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync call to the fscanf function. Execution of a %n directive does
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync not increment the assignment count returned at the completion
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync of execution of the fscanf function. No argument is converted,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync but one is consumed. If the conversion specification includes
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an assignment suppressing character the conversion specification
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is ignored. If the conversion specification contains a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync field width, the field width will be ignored.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - % Matches a single % character; no conversion or assignment occurs.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] stream An open File specifier from which the input is read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be matched against, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync items are stored according to their associated arguments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ... Variable number of parameters, as required by format,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifying the objects to receive the converted input.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fscanf function returns EOF if an input failure occurs before
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync any conversion. Otherwise the number of input items assigned
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is returned; which can be fewer than provided for, or even zero
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the event of an early matching failure.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fscanf (FILE * __restrict stream, const char * __restrict format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Formatted print to stdout.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The printf function is equivalent to fprintf with stdout used as the output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be copied unchanged, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Copied and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted characters are sent to the output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ... Variable number of parameters as required by format.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The printf function returns the number of characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transmitted, or a negative value if an output or encoding
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error occurred.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint printf (const char * __restrict format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Formatted input from stdin.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The scanf function is equivalent to fscanf with stdin used as the input stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be matched against, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync items are stored according to their associated arguments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] ... Variable number of parameters, as required by format,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifying the objects to receive the converted input.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The scanf function returns EOF if an input failure occurs before
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync any conversion. Otherwise the number of input items assigned
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is returned; which can be fewer than provided for, or even zero
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the event of an early matching failure.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint scanf (const char * __restrict format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Formatted output to a buffer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The sprintf function is equivalent to fprintf, except that the output is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync written into array Buff instead of to a stream. A null character is written
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync at the end of the characters written; it is not counted as part of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buff A pointer to the array to receive the formatted output.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be copied unchanged, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Copied and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted characters are written to the array pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Buff.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ... Variable number of parameters as required by format.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The sprintf function returns the number of characters written in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the array, not counting the terminating null character, or a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync negative value if an encoding error occurred.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint sprintf (char * __restrict Buff, const char * __restrict Format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Formatted input from a string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The sscanf function is equivalent to fscanf, except that input is obtained
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync from a string rather than from a stream. Reaching the end of the string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is equivalent to encountering end-of-file for the fscanf function.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Buff Pointer to the string from which to obtain input.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be matched against, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync items are stored according to their associated arguments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] ... Variable number of parameters, as required by format,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specifying the objects to receive the converted input.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The scanf function returns EOF if an input failure occurs before
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync any conversion. Otherwise the number of input items assigned
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is returned; which can be fewer than provided for, or even zero
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the event of an early matching failure.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint sscanf (const char * __restrict Buff, const char * __restrict Format, ...);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Print formatted values from an argument list.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The vfprintf function is equivalent to fprintf, with the variable argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync list replaced by Args, which must have been initialized by the va_start macro.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The vfprintf function does not invoke the va_end macro.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream The output stream to receive the formatted output.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be matched against, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync items are stored according to their associated arguments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Args A list of arguments, initialized by the va_start macro
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and accessed using the va_arg macro, used to satisfy
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the directives in the Format string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The vfprintf function returns the number of characters transmitted,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or a negative value if an output or encoding error occurred.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint vfprintf(FILE * __restrict Stream, const char * __restrict Format, va_list Args);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Formatted print, to stdout, from an argument list.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The vprintf function is equivalent to printf, with the variable argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync list replaced by Args, which must have been initialized by the va_start
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync macro (and possibly subsequent va_arg calls). The vprintf function does
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync not invoke the va_end macro.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be matched against, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Converted
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync items are stored according to their associated arguments.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Args A list of arguments, initialized by the va_start macro
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and accessed using the va_arg macro, used to satisfy
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the directives in the Format string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The vprintf function returns the number of characters transmitted,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or a negative value if an output or encoding error occurred.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint vprintf (const char * __restrict Format, va_list Args);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Formatted print, to a buffer, from an argument list.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The vsprintf function is equivalent to sprintf, with the variable argument
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync list replaced by Args, which must have been initialized by the va_start
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync macro. The vsprintf function does not invoke the va_end macro.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buff A pointer to the array to receive the formatted output.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Format A multi-byte character sequence containing characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be copied unchanged, and conversion specifiers
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which convert their associated arguments. Copied and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync converted characters are written to the array pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Buff.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Args A list of arguments, initialized by the va_start macro
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and accessed using the va_arg macro, used to satisfy
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the directives in the Format string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The vsprintf function returns the number of characters written in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the array, not counting the terminating null character, or a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync negative value if an encoding error occurred.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint vsprintf(char * __restrict Buff, const char * __restrict Format, va_list Args);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Character Input/Output Functions. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Get a character from an input Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If the end-of-file indicator for the input stream pointed to by Stream is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync not set, and a next character is present, the fgetc function obtains that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character as an unsigned char converted to an int and advances the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync associated file position indicator for the stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream An input stream from which to obtain a character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If the end-of-file indicator for the stream is set, or if the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is at end-of-file, the end-of-file indicator for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is set and the fgetc function returns EOF. Otherwise,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the fgetc function returns the next character from the input
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream pointed to by Stream. If a read error occurs, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error indicator for the stream is set and the fgetc function
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returns EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fgetc (FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Read a string from an input stream into a buffer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fgets function reads at most one less than the number of characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specified by Limit from the stream pointed to by Stream into the array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by Buff. No additional characters are read after a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync new-line character (which is retained) or after end-of-file. A null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character is written immediately after the last character read into the array.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buff A pointer to the array to receive the input string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Limit The maximum number of characters to put into Buff,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync including the terminating null character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream An input stream from which to obtain a character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fgets function returns Buff if successful. If end-of-file is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync encountered and no characters have been read into the array, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contents of the array remain unchanged and a null pointer is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned. If a read error occurs during the operation, the array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contents are indeterminate and a null pointer is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *fgets (char * __restrict Buff, int Limit, FILE * __restrict Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Write a character to an output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fputc function writes the character specified by C (converted to an
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char) to the output stream pointed to by Stream, at the position
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indicated by the associated file position indicator for the stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (if defined), and advances the indicator appropriately. If the file cannot
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync support positioning requests, or if the stream was opened with append mode,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the character is appended to the output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character to be written to Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream The output stream that C is to be written to.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fputc function returns the character written. If a write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error occurs, the error indicator for the stream is set and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fputc returns EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fputc (int C, FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Write a string to an output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fputs function writes String to the stream pointed to by Stream. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null character is not written.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] String The character string to be written to Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream The output stream that String is to be written to.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fputs function returns EOF if a write error occurs; otherwise
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync it returns a non-negative value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fputs (const char * __restrict String, FILE * __restrict Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Get a character from an input stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The getc function is equivalent to fgetc, except that if it is implemented
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as a macro, it may evaluate stream more than once, so the argument should
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync never be an expression with side effects.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream An input stream from which to obtain a character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If the end-of-file indicator for the stream is set, or if the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is at end-of-file, the end-of-file indicator for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is set and getc returns EOF. Otherwise, getc returns
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the next character from the input stream pointed to by Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If a read error occurs, the error indicator for the stream is set
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and getc returns EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint getc (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Get a character from stdin.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The getchar function is equivalent to getc with the argument stdin.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If the end-of-file indicator for stdin is set, or if stdin
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is at end-of-file, the end-of-file indicator is set and getchar
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returns EOF. Otherwise, getchar returns the next character from
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stdin. If a read error occurs, the error indicator for stdin is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync set and getchar returns EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint getchar (void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Read a string from stdin into a buffer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The gets function reads characters from the input stream pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stdin, into the array pointed to by Buff, until end-of-file is encountered
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or a new-line character is read. Any new-line character is discarded, and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a null character is written immediately after the last character read into
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the array.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buff A pointer to the array to receive the input string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The gets function returns Buff if successful. If end-of-file is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync encountered and no characters have been read into the array, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contents of the array remain unchanged and a null pointer is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned. If a read error occurs during the operation, the array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contents are indeterminate and a null pointer is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *gets (char *Buff);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Write a character to an output stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The putc function is equivalent to fputc, except that if it is implemented
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync as a macro, it may evaluate Stream more than once, so that argument should
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync never be an expression with side effects.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character to be written to Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream The output stream that C is to be written to.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The putc function returns the character written. If a write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error occurs, the error indicator for the stream is set and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync putc returns EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint putc (int C, FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Write a character to stdout.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The putchar function is equivalent to putc with stdout as the Stream argument.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character to be written to stdout.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The putchar function returns the character written. If a write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error occurs, the error indicator for stdout is set and putchar
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returns EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint putchar (int C);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Write String to stdout.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The puts function writes the string pointed to by String to the stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by stdout, and appends a new-line character to the output. The
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null character is not written.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] String A pointer to the character string to write to stdout.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The puts function returns EOF if a write error occurs; otherwise
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync it returns a non-negative value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint puts (const char *String);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Return a character to the input Stream as if it had not been read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The ungetc function pushes the character specified by C (converted to an
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char) back onto the input stream pointed to by Stream. Pushed-back
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters will be returned by subsequent reads on that stream in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync reverse order of their being pushed. A successful intervening call
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (with the stream pointed to by Stream) to a file positioning function
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (fseek, fsetpos, or rewind) discards any pushed-back characters for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream. The external storage corresponding to the stream is unchanged.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync One character of pushback is guaranteed. If the ungetc function is called
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync too many times on the same stream without an intervening read or file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync positioning operation on that stream, the operation will fail.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If the value of C equals that of the macro EOF, the operation fails and the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync input stream is unchanged.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A successful call to the ungetc function clears the end-of-file indicator
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync for the stream. The value of the file position indicator for the stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync after reading or discarding all pushed-back characters is the same as it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync was before the characters were pushed back. For a binary stream, its
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync file position indicator is decremented by each successful call to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ungetc function; if its value was zero before a call, it will remain zero
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync after the call.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character to push back onto the Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream The output stream that C is to be pushed back onto.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The ungetc function returns the character pushed back,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or EOF if the operation fails.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint ungetc (int C, FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Direct Input/Output Functions. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Read Num elements of size Size from a Stream into a Buffer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fread function reads, into the array pointed to by Buffer, up to Num
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync elements, whose size is specified by Size, from the stream pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Stream. For each object, Size calls are made to the fgetc function and the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync results stored, in the order read, in an array of unsigned char exactly
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync overlaying the Buffer object. The file position indicator for the stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (if defined) is advanced by the number of characters successfully read. If
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an error occurs, the resulting value of the file position indicator for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is indeterminate.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buffer Pointer to an object to receive the read data.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Size Size of each element to be read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Num Number of elements to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Input stream to read the data from.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fread function returns the number of elements successfully
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync read, which may be less than Num if a read error or end-of-file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync is encountered. If Size or Num is zero, fread returns zero and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the contents of the array and the state of the stream remain
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unchanged.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t fread (void * __restrict Buffer,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t Size,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t Num,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE * __restrict Stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Write Num elements of size Size from Buffer to Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fwrite function writes, from the array pointed to by Buffer, up to Num
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync elements whose size is specified by Size, to the stream pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Stream. For each object, Size calls are made to the fputc function, taking
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the values (in order) from an array of unsigned char exactly overlaying the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Buffer object. The file position indicator for the stream (if defined) is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync advanced by the number of characters successfully written. If an error
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync occurs, the resulting value of the file position indicator for the stream is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indeterminate.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Buffer Pointer to an object containing the data to be written.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Size Size of each element to be written.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Num Number of elements to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Output stream to write the data to.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The fwrite function returns the number of elements successfully
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync written, which will be less than Num only if a write error is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync encountered. If Size or Num is zero, fwrite returns zero and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the state of the stream remains unchanged.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t fwrite (const void * __restrict Buffer,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t Size,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t Num,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE * __restrict Stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ File Positioning Functions. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Get a stream's position and parse state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fgetpos function stores the current values of the parse state (if any)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and file position indicator for the stream pointed to by Stream in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync object pointed to by Pos. The values stored contain unspecified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync information usable by the fsetpos function for repositioning the stream
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to its position at the time of the call to the fgetpos function.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Stream to get current position of.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Pos Object to receive the stream's state and position information.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If successful, the fgetpos function returns zero; if either
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync parameter is NULL, the fgetpos function returns nonzero and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stores EINVAL in errno.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fgetpos (FILE * __restrict Stream, fpos_t * __restrict Pos);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Set the file position for a stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fseek function sets the file position indicator for the stream pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Stream. If a read or write error occurs, the error indicator for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is set and fseek fails.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync For a binary stream, the new position, measured in characters from the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync beginning of the file, is obtained by adding Offset to the position
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specified by Whence. The specified position is the beginning of the file if
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Whence is SEEK_SET, the current value of the file position indicator if
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync SEEK_CUR, or end-of-file if SEEK_END.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync For a text stream, Offset must either be zero or a value returned by an
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync earlier successful call to the ftell function, on a stream associated with
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the same file, and Whence must be SEEK_SET.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync After determining the new position, a successful call to the fseek function
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync undoes any effects of the ungetc function on the stream, clears the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync end-of-file indicator for the stream, and then establishes the new position.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync After a successful fseek call, the next operation on an update stream may
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync be either input or output.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream The I/O stream to set the position of.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Offset The position, interpreted depending upon the value of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Whence, that the stream is to be positioned to.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Whence A value indicating how Offset is to be interpreted:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - SEEK_SET indicates Offset is an absolute position.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - SEEK_END indicates Offset is relative to the end of the file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - SEEK_CUR indicates Offset is relative to the current position.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync@return The fseek function returns nonzero only for a request that cannot be satisfied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fseek (FILE *Stream, long Offset, int Whence);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Set a stream's position and parse state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The fsetpos function sets the mbstate_t object (if any) and file position
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indicator for the stream pointed to by Stream according to the value of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync object pointed to by Pos, which is a value that was obtained from an
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync earlier successful call to the fgetpos function on a stream associated with
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the same file. If a read or write error occurs, the error indicator for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync stream is set and fsetpos fails.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A successful call to the fsetpos function undoes any effects of the ungetc
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function on the stream, clears the end-of-file indicator for the stream,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and then establishes the new parse state and position. After a successful
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fsetpos call, the next operation on an update stream may be either input or output.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Stream to set current position of.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Pos Object containing the state and position information.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If successful, the fsetpos function returns zero; on failure, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fsetpos function returns nonzero and stores EINVAL, or ESPIPE,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in errno; depending upon whether the error was because of an invalid
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync parameter, or because Stream is not seekable.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fsetpos (FILE *Stream, const fpos_t *Pos);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Get Stream's current position.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The ftell function obtains the current value of the file position indicator
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync for the stream pointed to by Stream. For a binary stream, the value is the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync number of characters from the beginning of the file. For a text stream, its
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync file position indicator contains unspecified information, usable by the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fseek function for returning the file position indicator for the stream to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync its position at the time of the ftell call; the difference between two such
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return values is not necessarily a meaningful measure of the number of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters written or read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Pointer to the FILE object to get the current position of.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return If successful, the ftell function returns the current value of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the file position indicator for the stream. On failure, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ftell function returns -1L and stores ESPIPE in errno indicating
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync that the stream is not seekable.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynclong ftell (FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Restore a Stream's file position to the beginning of the file.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The rewind function sets the file position indicator for the stream pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Stream to the beginning of the file and clears the stream's error indicator.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Pointer to the stream to be positioned to its beginning.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid rewind (FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Error-handling Functions. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Clear a Stream's error and end-of-file indicators.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Pointer to the stream to be cleared of errors.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid clearerr(FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Test the end-of-file indicator for Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Pointer to the FILE object to be tested for EOF.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The feof function returns non-zero if, and only if, the end-of-file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indicator is set for Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint feof (FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Test the error indicator for Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Stream Pointer to the stream to be tested for error.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The ferror function returns non-zero if, and only if, the error
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indicator is set for Stream.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint ferror (FILE *Stream);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Print an error message to stderr based upon the value of errno and String.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The perror function maps the error number in the integer expression errno
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to an error message. It writes a sequence of characters to the standard
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync error stream thus: first (if String is not a null pointer and the character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by String is not the null character), the string pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync String followed by a colon (:) and a space; then an appropriate error
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync message string followed by a new-line character. The contents of the error
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync message strings are the same as those returned by the strerror function
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync with argument errno.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] String A text string to prefix the output error message with.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @sa strerror in <string.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid perror (const char *String);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * IEEE Std 1003.1-90
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncFILE *fdopen(int, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid flockfile (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint ftrylockfile (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid funlockfile (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint getc_unlocked (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint getchar_unlocked(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint putc_unlocked (int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint putchar_unlocked(int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Functions defined in POSIX 1003.2 and XPG2 or later.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int pclose (FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *popen (const char *, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int snprintf (char * __restrict, size_t, const char * __restrict, ...)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __attribute__((__format__(__printf__, 3, 4)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vsnprintf(char * __restrict, size_t, const char * __restrict, va_list)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __attribute__((__format__(__printf__, 3, 0)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Functions defined in XPG4.2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //int getw(FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //int putw(int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *mkdtemp(char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int mkstemp(char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *mktemp(char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *tempnam(const char *, const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * X/Open CAE Specification Issue 5 Version 2
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef off_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync typedef __off_t off_t;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define off_t __off_t
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif /* off_t */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint fseeko(FILE *, off_t, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncoff_t ftello(FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Routines that are purely local.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FPARSELN_UNESCESC 0x01
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FPARSELN_UNESCCONT 0x02
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FPARSELN_UNESCCOMM 0x04
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FPARSELN_UNESCREST 0x08
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define FPARSELN_UNESCALL 0x0f
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //int asprintf(char ** __restrict, const char * __restrict, ...)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // __attribute__((__format__(__printf__, 2, 3)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *fgetln(FILE * __restrict, size_t * __restrict);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int fpurge(FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void setbuffer(FILE *, char *, int);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int setlinebuf(FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vasprintf(char ** __restrict, const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync va_list)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __attribute__((__format__(__printf__, 2, 0)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vscanf(const char * __restrict, va_list)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __attribute__((__format__(__scanf__, 1, 0)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //int vfscanf(FILE * __restrict, const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // va_list)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // __attribute__((__format__(__scanf__, 2, 0)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int vsscanf(const char * __restrict, const char * __restrict,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync va_list)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __attribute__((__format__(__scanf__, 2, 0)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //const char *fmtcheck(const char *, const char *)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // __attribute__((__format_arg__(2)));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Stdio function-access interface.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync FILE *funopen(const void *,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*)(void *, char *, int),
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*)(void *, const char *, int),
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync fpos_t (*)(void *, fpos_t, int),
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*)(void *));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Functions internal to the implementation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __srget(FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint __swbuf(int, FILE *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The __sfoo macros are here so that we can
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * define function versions in the C library.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#if defined(__GNUC__) && defined(__STDC__)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync static __inline int __sputc(int _c, FILE *_p) {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return (*_p->_p++ = _c);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return (__swbuf(_c, _p));
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync }
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#else
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * This has been tuned to generate reasonable code on the vax using pcc.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define __sputc(c, p) \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (--(p)->_w < 0 ? \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (p)->_w >= (p)->_lbfsize ? \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (*(p)->_p = (unsigned char)(c)), *(p)->_p != '\n' ? \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (int)*(p)->_p++ : \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __swbuf('\n', p) : \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync __swbuf((int)(c), p) : \
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (*(p)->_p = (unsigned char)(c), (int)*(p)->_p++))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __sferror(p) (((p)->_flags & __SERR) != 0)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __sfileno(p) ((p)->_file)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef __lint__
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define feof(p) __sfeof(p)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define ferror(p) __sferror(p)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define clearerr(p) __sclearerr(p)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define getc(fp) __sgetc(fp)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #define putc(x, fp) __sputc(x, fp)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif /* __lint__ */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define getchar() getc(stdin)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define putchar(x) putc(x, stdout)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define fileno(p) __sfileno(p)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define getc_unlocked(fp) __sgetc(fp)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define putc_unlocked(x, fp) __sputc(x, fp)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define getchar_unlocked() getc_unlocked(stdin)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define putchar_unlocked(x) putc_unlocked(x, stdout)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif /* _STDIO_H_ */