- IO
- Overview
- Summary
- Files
- Data Structures
- Macros
- Typedefs
- Functions
- Details
- Macro Definition Documentation
- FD_CLR
- FD_ISSET
- FD_SET
- FD_ZERO
- Function Documentation
- asprintf()
- catclose()
- catgets()
- catopen()
- clearerr()
- dprintf()
- err()
- errx()
- fclose()
- feof()
- ferror()
- ferror_unlocked()
- fflush()
- fgetc()
- fgetc_unlocked()
- fgetln()
- fgetpos()
- fgets()
- fileno()
- fmemopen()
- fopen()
- fprintf()
- fputc()
- fputc_unlocked()
- fputs()
- fread()
- fscanf()
- fseek()
- fseeko()
- fsetpos()
- ftell()
- ftello()
- ftrylockfile()
- funlockfile()
- fwrite()
- getc()
- getc_unlocked()
- getchar()
- getchar_unlocked()
- getdelim()
- getline()
- gets()
- getw()
- iconv()
- iconv_close()
- iconv_open()
- lio_listio()
- localeconv()
- open_memstream()
- pclose()
- perror()
- poll()
- preadv()
- printf()
- putc()
- putc_unlocked()
- putchar()
- putchar_unlocked()
- puts()
- putw()
- pwritev()
- readv()
- remove()
- rename()
- rewind()
- scanf()
- select()
- setbuf()
- setbuffer()
- setlinebuf()
- setlocale()
- setvbuf()
- snprintf()
- sprintf()
- sscanf()
- tempnam()
- ungetc()
- vasprintf()
- vdprintf()
- verr()
- verrx()
- vfprintf()
- vfscanf()
- vprintf()
- vscanf()
- vsnprintf()
- vsprintf()
- vsscanf()
- vwarn()
- vwarnx()
- warn()
- warnx()
- wordfree()
- writev()
IO
Overview
Provides data structures and functions for performing input/output (I/O) operations, such as printf and scanf.
Since:
1.0
Version:
1.0
Summary
Files
Data Structures
Macros
Waiting to be notified of the completion of all asynchronous I/O operations. |
|
Not waiting to be notified of the completion of all asynchronous I/O operations. |
|
Language symbol type, which affects character classification and case conversion. |
|
Character sorting type, which affects string comparison and sorting habits. |
|
Message type, which affects prompt information, error information, status information, titles, labels, buttons, and menus. |
|
All types, which affect all content of locale settings. If LC_ALL is set, the locale information of all types is set to be consistent with LC_ALL. |
|
Defines the size of fd_set, that is, the maximum number of monitored files. |
|
FD_ZERO(s) do { int i; unsigned long *b=(s)->fds_bits; for(i=sizeof (fd_set)/sizeof (long); i; i—) *b++=0; } while(0) |
|
FD_SET(d, s) ((s)->fds_bits[(d)/(8sizeof(long))] |= (1UL<<((d)%(8sizeof(long))))) |
|
FD_CLR(d, s) ((s)->fds_bits[(d)/(8sizeof(long))] &= ~(1UL<<((d)%(8sizeof(long))))) |
|
FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8sizeof(long))] & (1UL<<((d)%(8sizeof(long))))) |
Typedefs
Defines fd_set as the alias of the element type. |
Functions
lio_listio (int mode, struct aiocb restrict const restrict cbs, int cnt, struct sigevent restrict sev) |
|
warn (const char fmt,…) |
Displays a formatted error message on the standard error (stderr) output. |
vwarn (const char fmt, va_list args) |
|
warnx (const char fmt,…) |
|
vwarnx (const char fmt, va_list args) |
|
err (int eval, const char fmt, va_list args) |
|
errx (int eval, const char fmt,…) |
|
verr (int eval, const char fmt, va_list args) |
|
verrx (int eval, const char fmt, va_list args) |
|
iconv_open (const char to, const char from) |
|
iconv (iconv_t cd, char **restrict in, size_t restrict inb, char restrict out, size_t restrict outb) |
|
iconv_close (iconv_t cd) |
|
setlocale (int category, const char locale) |
Sets the current locale information based on input parameters. |
localeconv (void) |
struct lconv Obtains the locale information about a region and stores them in lconv. |
catopen (const char name, int oflag) |
|
catgets (nl_catd catd, int set_id, int msg_id, const char s) |
|
fopen (const char restrict path, const char *restrict mode) |
Opens the file stored in the specified path based on the given mode. |
remove (const char pathname) |
|
rename (const char oldpath, const char newpath) |
|
Changes the position of a specified stream to a new position. |
|
Obtains the current value of the file position indicator for a specified file stream. |
|
Sets the position indicator of a specified stream to the beginning of the file. |
|
Obtains the current file position of a specified stream and writes it to the pos parameter. |
|
Sets the file position indicator for a specified file stream. |
|
fread (void __restrict ptr, size_t size, size_t nmemb, FILE restrict stream) |
|
fwrite (const void *restrict ptr, size_t size, size_t nmemb, FILE __restrict stream) |
|
getchar (void) |
|
Writes a character into the position pointed to by a specified stream. |
|
putchar (int c) |
|
Reads a line of characters from a specified file stream and stores it into the string pointed to by s. |
|
gets (char s) |
Reads a line of characters from the stdin and stores it in the buffer. |
Writes a character string (excluding the terminating null character) to a specified file stream. |
|
puts (const char s) |
Writes a character string and appends a new-line character to the stdout. |
printf (const char format,…) |
Formats arguments based on format and prints formatted data to the stdout. |
Formats arguments based on format and prints formatted data to a specified file stream. |
|
sprintf (char str, const char format,…) |
Prints formatted data from a variable argument list to a specified string. |
snprintf (char str, size_t size, const char format,…) |
Prints formatted data of a maximum of size bytes from a variable argument list to a specified string. |
vprintf (const char format, va_list ap) |
Prints formatted data from a variable argument list to the stdout. |
Prints formatted data from a variable argument list to a specified file stream. |
|
vsprintf (char str, const char format, va_list ap) |
Prints formatted data from a variable argument list to a specified string. |
vsnprintf (char str, size_t size, const char format, va_list ap) |
Prints formatted data of a maximum of size bytes from a variable argument list to a specified string. |
scanf (const char format,…) |
Reads formatted data from the stdin and stores the data to the additional arguments based on format. |
Reads formatted data from a specified file stream and stores it based on format into the locations pointed to by the variable arguments. |
|
sscanf (const char str, const char format,…) |
Reads data from a character string pointed to by str and stores it based on format into the locations pointed to by the variable arguments. |
vscanf (const char format, va_list ap) |
Reads data from the stdin and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap. |
Reads data from a specified file stream and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap. |
|
vsscanf (const char str, const char format, va_list ap) |
Reads data from a specified string and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap. |
perror (const char msg) |
Prints the last error occurred during a call to a system or library function to the standard error output stream (stderr). |
Sets the mode and size of the buffer for a specified stream. |
|
fmemopen (void buf, size_t size, const char mode) |
FILE * Opens a memory stream that allows the access mode specified by mode. |
open_memstream (char ptr, size_t size) |
|
Sets the position of the next input or output operation on a specified file stream. |
|
Obtains the current value of the file position indicator for a specified file stream. |
|
dprintf (int fd, const char format,…) |
|
vdprintf (int fd, const char format, va_list ap) |
Prints formatted data from a variable argument list to a specified file. |
ftrylockfile (FILE filehandle) |
|
funlockfile (FILE filehandle) |
|
getc_unlocked (FILE stream) |
Obtains a character from a specified file stream without locking the file stream or checking whether it is locked. |
getchar_unlocked (void) |
|
putc_unlocked (int c, FILE stream) |
Writes a character to a specified file stream with the thread remains unlocked. |
putchar_unlocked (int c) |
Writes a character to the stdout with the thread remains unlocked. |
tempnam (const char dir, const char prefix) |
|
setlinebuf (FILE f) |
|
fgetc_unlocked (FILE stream) |
Reads a character from the file pointed to by stream with the thread remains unlocked. |
fputc_unlocked (int c, FILE stream) |
Writes a character to the file stream pointed to by stream at the current position. |
ferror_unlocked (FILE stream) |
|
Reads a line of data from the current position of a specified file stream. |
|
asprintf (char **strp, const char fmt,…) |
|
vasprintf (char *strp, const char fmt, va_list ap) |
Prints formatted data from a variable argument list to a specified character string. |
select (int nfds, fd_set __restrict readfds, fd_set restrict writefds, fd_set *restrict exceptfds, struct timeval __restrict timeout) |
|
readv (int fd, const struct iovec iov, int iovcnt) |
|
writev (int fd, const struct iovec iov, int iovcnt) |
|
preadv (int fd, const struct iovec iov, int iovcnt, off_t offset) |
Reads the data in a file whose fd offset is offset to the multi-group buffer space pointed to by iov. |
pwritev (int fd, const struct iovec iov, int iovcnt, off_t offset) |
Writes the data of a multi-group buffer space pointed to by iov to the offset of fd. |
Details
Macro Definition Documentation
FD_CLR
#define FD_CLR( d, s ) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
Description:
Removes a file descriptor from a set.
Parameters:
d | Indicates the file descriptor of the int type. |
s | Indicates the descriptor set of the fd_set type. |
FD_ISSET
#define FD_ISSET( d, s ) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
Description:
Checks whether a file descriptor is in a set.
Parameters:
d | Indicates the file descriptor of the int type. |
s | Indicates the descriptor set of the fd_set type. |
Returns:
Returns 0 if the file descriptor is not in the set; returns 1 if the file descriptor is in the set.
FD_SET
#define FD_SET( d, s ) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
Description:
Adds a file descriptor to a set.
Parameters:
d | Indicates the file descriptor of the int type. |
s | Indicates the descriptor set of the fd_set type. |
FD_ZERO
#define FD_ZERO( s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof ([fd_set]($api-api-SmartVision-Devices-fd_set.md))/sizeof (long); __i; __i--) *__b++=0; } while(0)
Description:
Clears all elements in the file descriptor set.
Parameters:
s | Indicates the descriptor set of the fd_set type. |
Function Documentation
asprintf()
int asprintf (char ** strp, const char * fmt, ... )
Description:
Prints formatted data to a specified character string.
If the length of the string is uncertain, this function applies for sufficient memory space based on the length of the formatted character string.
Parameters:
strp | Indicates the double pointer to the start address of the target string. |
fmt | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Attention:
If strp is no longer used, the applied space must be released.
Returns:
Returns the number of output characters if the operation is successful; returns -1 otherwise.
catclose()
int catclose ([nl_catd]($api-api-SmartVision-Devices-IO.md#ga3f305b6699c89f91aecfc0b5f8604a5f) catd)
Description:
Closes a catalog descriptor.
Parameters:
catd | Indicates the catalog descriptor to close. |
Returns:
0
catgets()
char* catgets ([nl_catd]($api-api-SmartVision-Devices-IO.md#ga3f305b6699c89f91aecfc0b5f8604a5f) catd, int set_id, int msg_id, const char * s )
Description:
Obtains information from a message catalog.
Parameters:
catd | Indicates the descriptor of the message catalog. |
set_id | Indicates the setting ID of the message catalog. |
msg_id | Indicates the ID of the message catalog. |
s | Indicates the pointer to a string to be returned if the operation fails. |
Returns:
Returns the information obtained from the message catalog if the operation is successful; returns s otherwise.
catopen()
[nl_catd]($api-api-SmartVision-Devices-IO.md#ga3f305b6699c89f91aecfc0b5f8604a5f) catopen (const char * name, int oflag )
Description:
Opens a message catalog and returns its descriptor.
Parameters:
name | Indicates the pointer to the path name of the message catalog to open. |
oflag | Indicates the source of the language to use. |
Returns:
Returns the catalog descriptor if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
clearerr()
void clearerr ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp)
Description:
Resets the error indicators.
This function is used to set both the file error indicator and end-of-file indicator to 0.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream to set. |
dprintf()
int dprintf (int fd, const char * format, ... )
Description:
Prints formatted data to a specified file.
Parameters:
fd | Indicates the file descriptor that identifies a file. |
format | Indicates the pointer to the format string. |
Returns:
Returns the total number of written characters if the operation is successful; returns a negative value otherwise.
err()
void err (int eval, const char * fmt, va_list args )
Description:
Displays error information.
If the fmt parameter is not NULL, stderr displays the error code description obtained from strerror(errno), followed by a space and a colon (:), and the error message to print.
Parameters:
eval | This function does not return, but exits with the value of eval. |
fmt | Indicates the pointer to the string to format. |
args | Indicates the parameters initialized by using va_start. |
errx()
void errx (int eval, const char * fmt, ... )
Description:
Displays error information.
This function outputs the executable file name argv[0] and the accepted second formal parameter to stderr.
Parameters:
eval | This function does not return, but exits with the value of eval. |
fmt | Indicates the pointer to the string to format. |
fclose()
int fclose ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fd)
Description:
Closes a file based on the specified file descriptor.
Parameters:
fd | Indicates the pointer to the file descriptor of the file to close. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
feof()
int feof ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp)
Description:
Tests the end-of-file indicator for a specified stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream to test. |
Returns:
Returns a non-zero value if the end-of-file indicator is set; returns 0 otherwise.
ferror()
int ferror ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Tests for the error identifier of a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns a non-zero value to indicate an error for the stream if the operation is successful; returns 0 otherwise.
ferror_unlocked()
int ferror_unlocked ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Tests for the error identifier of a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns a non-zero value to indicate an error for the stream if the operation is successful; returns 0 otherwise.
fflush()
int fflush ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp)
Description:
Flushes the output buffer of a specified stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream to flush. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
fgetc()
int fgetc ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Reads a character from the file pointed to by stream.
This function reads the next character from the current position of the file stream and returns the character, then advances the file position indicator. You can read each character of the file by continuously calling this function.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns the character read as an int value if the operation is successful; returns EOF if the end-of-file is reached or a reading error occurs.
fgetc_unlocked()
int fgetc_unlocked ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Reads a character from the file pointed to by stream with the thread remains unlocked.
This function reads the next character from the current position of the file stream and returns the character, then advances the file position indicator. You can read each character of the file by continuously calling this function.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
This function cannot be used in a multi-thread process because it does not use locking during the call. (It does not set locks itself, and does not test for the presence of locks set by others.) An error occurs upon a multi-thread operation.
Returns:
Returns the character read as an int value if the operation is successful; returns EOF if the end-of-file is reached or a reading error occurs.
fgetln()
char* fgetln ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, size_t * len )
Description:
Reads a line of data from the current position of a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
len | Indicates the pointer to the length of the string that is read. |
Returns:
Returns the string read.
fgetpos()
int fgetpos ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, fpos_t * pos )
Description:
Obtains the current file position of a specified stream and writes it to the pos parameter.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
pos | Indicates the pointer to the fpos_t object. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
fgets()
char* fgets (char * s, int size, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Reads a line of characters from a specified file stream and stores it into the string pointed to by s.
Parameters:
Returns:
Returns the pointer to the read string if the operation is successful; returns a null pointer if the end-of-file is reached, no characters have been read, or if an error occurs.
fileno()
int fileno ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp)
Description:
Obtains the file descriptor of a specified file stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream for which the file descriptor is obtained. |
Returns:
Returns the file descriptor if the operation is successful; returns -1 and sets errno to a value in the following table otherwise.
fmemopen()
[FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1)* fmemopen (void * buf, size_t size, const char * mode )
Description:
Opens a memory stream that allows the access mode specified by mode.
This function is used for applications that do not support memory operations but support file operations. After the function call, you can directly operate the returned file stream, which is equivalent to operating the memory stream.
Parameters:
buf | Indicates the pointer to the buffer. |
size | Indicates the size of the buffer. |
mode | Indicates the pointer to the file operation mode. |
Returns:
Returns the opened memory stream as a file stream.
fopen()
[FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1)* fopen (const char *__restrict path, const char *__restrict mode )
Description:
Opens the file stored in the specified path based on the given mode.
Parameters:
path | Indicates the pointer to the path of the file to open. |
mode | Indicates the pointer to the file access mode. The following table describes the available values. |
Attention:
This function can NOT be used in the PROC file system to create a file.
Returns:
Returns the pointer to the file if the operation is successful; returns NULL and sets errno to a value in the following table if the operation fails.
fprintf()
int fprintf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const char * format, ... )
Description:
Formats arguments based on format and prints formatted data to a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Returns:
Returns the total number of characters (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
fputc()
int fputc (int c, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a character into the position pointed to by a specified stream.
Parameters:
c | Indicates the int promotion of the character to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns the ASCII code of the character written if the operation is successful; returns EOF otherwise.
fputc_unlocked()
int fputc_unlocked (int c, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a character to the file stream pointed to by stream at the current position.
Parameters:
c | Indicates the int promotion of the character to write. |
stream | Indicates the pointer to the file stream. |
Attention:
This function cannot be used in a multi-thread process because it does not use locking during the call. (It does not set locks itself, and does not test for the presence of locks set by others.) An error occurs upon a multi-thread operation.
Returns:
Returns the ASCII code of the character written if the operation is successful; returns EOF otherwise.
fputs()
int fputs (const char * s, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a character string (excluding the terminating null character) to a specified file stream.
Parameters:
s | Indicates the pointer to the character string to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Returns:
Returns a non-negative value if the operation is successful; returns EOF otherwise.
fread()
size_t fread (void *__restrict ptr, size_t size, size_t nmemb, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) *__restrict stream )
Description:
Reads data from a specified stream.
Parameters:
ptr | Indicates the pointer to the array for storing the read data. |
size | Indicates the size of each element to read, in bytes. |
nmemb | Indicates the number of elements to read. |
stream | Indicates the pointer to the file object that identifies a stream to read. |
Returns:
Returns 0 if size or nmemb is 0; returns the number of elements successfully read otherwise. This function sets errno to a value in the following table if a reading error occurs or the end-of-file is reached (fread does not distinguish the two error reporting situations, and you can call feof and ferror to determine the specific situation).
fscanf()
int fscanf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const char * format, ... )
Description:
Reads formatted data from a specified file stream and stores it based on format into the locations pointed to by the variable arguments.
The operation ends when a space or line feed character is encountered.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Returns:
Returns the number of variables that are successfully read. If the matching fails quickly, the return value may be less than the number of members in the argument list or even zero. If no complete conversion format is available or the input format fails to be matched, EOF is returned. The return value is also EOF if a reading error occurs.
fseek()
int fseek ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp, long offset, int whence )
Description:
Changes the position of a specified stream to a new position.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream for which the position is to set. |
offset | Indicates the offset that determines the position. |
whence | Indicates the start position of the offset. The following table describes the available values. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
fseeko()
int fseeko ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp, off_t offset, int whence )
Description:
Sets the position of the next input or output operation on a specified file stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream for which the position is to set. |
offset | Indicates the offset that determines the next operation. |
whence | Indicates the start position of the offset. The following table describes the available values. |
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
fsetpos()
int fsetpos ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp, const fpos_t * pos )
Description:
Sets the file position indicator for a specified file stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream for which the position is to set. |
pos | Indicates the pointer to the position to set. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value and sets errno to a value in the following table if the operation fails.
ftell()
long ftell ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp)
Description:
Obtains the current value of the file position indicator for a specified file stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream for which the position is to obtain. |
Returns:
Returns the current offset if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
ftello()
off_t ftello ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * fp)
Description:
Obtains the current value of the file position indicator for a specified file stream.
Parameters:
fp | Indicates the pointer to the file object that identifies a stream for which the position is to obtain. |
Returns:
Returns the current offset if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
ftrylockfile()
int ftrylockfile ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * filehandle)
Description:
Locks a specified file.
This function facilitates I/O operations in multiple threads. If the file has been locked by another thread, this function waits until the file object is no longer locked by any thread and then locks it.
Parameters:
filehandle | Indicates the pointer to the file object. |
Returns:
Returns 0 if the locking is successful; returns a non-zero value otherwise.
funlockfile()
void funlockfile ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * filehandle)
Description:
Unlocks a specified file.
This function is used to reduce the lock count.
Parameters:
filehandle | Indicates the pointer to the file whose lock count is to be reduced. |
fwrite()
size_t fwrite (const void *__restrict ptr, size_t size, size_t nmemb, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) *__restrict stream )
Description:
Writes data to a specified stream.
Parameters:
ptr | Indicates the pointer to the data to write. |
size | Indicates the size of each element to write, in bytes. |
nmemb | Indicates the number of elements to write. |
stream | Indicates the pointer to the file object that identifies a stream to which data is to write. |
Returns:
Returns 0 if size or nmemb is 0; returns the number of elements successfully written otherwise. If this number is not nmemb, this function sets errno to a value in the following table if the number is not nmemb.
getc()
int getc ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Reads a character from a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
The difference between this function and fgetc is that this function can be implemented as a macro.
Returns:
Returns the character read as an int value if the operation is successful; returns EOF if the end-of-file is reached or a reading error occurs.
getc_unlocked()
int getc_unlocked ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Obtains a character from a specified file stream without locking the file stream or checking whether it is locked.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
Use this function with caution in multi-thread scenarios.
Returns:
Returns the obtained character.
getchar()
int getchar (void )
Description:
Obtains the next character from the standard input (stdin).
This function waits for user input and does not return until any input is available.
Returns:
Returns the character read as an int value if the operation is successful; returns EOF if the end-of-file is reached or a reading error occurs.
getchar_unlocked()
int getchar_unlocked (void )
Description:
Obtains the next character from stdin.
This function waits for user input and does not return until any input is available.
Attention:
Use this function with caution in multi-thread scenarios.
Returns:
Returns the character forcibly converted to an int value if the operation is successful; returns EOF if the end-of-file is reached or a reading error occurs.
getdelim()
ssize_t getdelim (char ** lineptr, size_t * n, int delim, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Reads an entire line from a specified file stream.
Parameters:
Attention:
If the system dynamically allocates memory, the memory needs to be released after being used.
Returns:
Returns the number of bytes read if the operation is successful; returns -1 otherwise.
getline()
ssize_t getline (char ** lineptr, size_t * n, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Reads an entire line from a specified file stream.
Parameters:
Attention:
If the system dynamically allocates memory, the memory needs to be released after being used.
Returns:
Returns the number of bytes read if the operation is successful; returns -1 otherwise.
gets()
char* gets (char * s)
Description:
Reads a line of characters from the stdin and stores it in the buffer.
Parameters:
s | Indicates the pointer to the memory buffer for storing the obtained string. |
Attention:
The gets() function cannot predict the size of the line to be read, which may cause buffer overflow. You are recommended not to use this function. POSIX.1-2008 and ISO C11 have marked this function as obsolete.
Returns:
Returns the value of s if the operation is successful; returns NULL otherwise.
getw()
int getw ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Reads a word (an int value) from a specified file stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
This function is provided for compatibility with System V Release 4 (SVR4). You are advised to use fread instead. The value returned upon an error is also a valid data value.
Returns:
Returns the integer read if the operation is successful; returns EOP otherwise.
iconv()
size_t iconv ([iconv_t]($api-api-SmartVision-Devices-IO.md#ga72517f6ffadddaafa9d51dee9b535c9f) cd, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb )
Description:
Converts a character set.
Parameters:
cd | Indicates the conversion descriptor obtained via iconv_open. |
in | Indicates the double pointer to the buffer for storing the input character. |
inb | Indicates the pointer to the length of the character input buffer. |
out | Indicates the double pointer to the buffer for storing the output character. |
outb | Indicates the pointer to length of the character output buffer. |
Returns:
Returns the number of irreversibly converted characters if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
An incomplete multi-byte sequence is encountered in the input. |
iconv_close()
int iconv_close ([iconv_t]($api-api-SmartVision-Devices-IO.md#ga72517f6ffadddaafa9d51dee9b535c9f) cd)
Description:
Closes a character set conversion descriptor.
Parameters:
cd | Indicates the conversion descriptor to close. |
Returns:
Returns 0.
iconv_open()
[iconv_t]($api-api-SmartVision-Devices-IO.md#ga72517f6ffadddaafa9d51dee9b535c9f) iconv_open (const char * to, const char * from )
Description:
Obtain a character set conversion descriptor.
Parameters:
to | Indicates the pointer to the source character set for conversion. |
from | Indicates the pointer to the target character set for conversion. |
Returns:
Returns the character set conversion descriptor if the operation is successful; returns -1 otherwise.
lio_listio()
int lio_listio (int mode, struct aiocb *restrict const *restrict cbs, int cnt, struct [sigevent]($api-api-SmartVision-Devices-sigevent.md) *restrict sev )
Description:
Initiates AIO requests.
Parameters:
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
localeconv()
struct [lconv]($api-api-SmartVision-Devices-lconv.md)* localeconv (void )
Description:
Obtains the locale information about a region and stores them in lconv.
Returns:
Returns a pointer to lconv that stores region information.
open_memstream()
[FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1)* open_memstream (char ** ptr, size_t * size )
Description:
Opens a stream for writing to a specified buffer.
The buffer is dynamically allocated and grown. After the stream is closed, call free() to release the buffer. When fclose() or fflush() is called to close or flush the stream, the pointers to the allocated buffer address and buffer size are updated to ptr and size, respectively. @attentions This function is defined in POSIX.1-2008. It is not defined in POSIX.1-2001 and is not widely used in other systems.
Parameters:
ptr | Indicates the pointer to the buffer address. |
size | Indicates the pointer to the buffer size. |
Returns:
Returns the pointer to the stream if the operation is successful; returns NULL and sets errno to indicate an error otherwise.
pclose()
int pclose ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * f)
Description:
Closes a specified pipe.
Parameters:
f | Indicates the pointer to the file object that identifies a pipe to close. |
Returns:
Returns the thread termination status code if the operation is successful; returns -1 and sets errno to a value in the following table otherwise.
The child process does not exist, or the specified process group does not exist. |
|
perror()
void perror (const char * msg)
Description:
Prints the last error occurred during a call to a system or library function to the standard error output stream (stderr).
Parameters:
msg | Indicates the pointer to the prompt message printed to stderr before the error message itself. |
Attention:
To make the output message more useful, msg should convey obvious information describing what happened. When a system call fails, it usually returns -1 and sets errno to a value that describes what went wrong. The error codes can be found in errno.h.
poll()
int poll (struct [pollfd]($api-api-SmartVision-Devices-pollfd.md) fds[], [nfds_t]($api-api-SmartVision-Devices-IO.md#ga0af7a8bdafcd5532e620a11f0d373d52) nfds, int timeout )
Description:
Defines the I/O multiplexing system.
This function is used to mount the pointer to the pollfd file to the waiting queue and then monitor the file.
Parameters:
Returns:
Returns a value greater than 0 if the total number of socket descriptors in fds is ready for read or write, or on which errors occur; returns 0 otherwise, in which case poll timed out. Returns -1 and sets errno to a value if this function fails to be called.
preadv()
ssize_t preadv (int fd, const struct iovec * iov, int iovcnt, off_t offset )
Description:
Reads the data in a file whose fd offset is offset to the multi-group buffer space pointed to by iov.
Parameters:
fd | Indicates the file descriptor. |
iov | Indicates the pointer to the multi-group buffer. |
iovcnt | Indicates the number of buffers. For details, see IOV_MAX. |
offset | Indicates the offset of the file descriptor to read. |
Returns:
Returns the number of bytes read if the operation is successful; returns -1 and sets errno to a value if the operation fails. If errno is set to EINVAL, the sum of the iov_len values overflows an ssize_t value, or the vector count iovcnt is less than 0 or greater than the permitted maximum.
printf()
int printf (const char * format, ... )
Description:
Formats arguments based on format and prints formatted data to the stdout.
Parameters:
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Attention:
format must correspond to the arguments specified in …. Otherwise, an error is returned.
Returns:
Returns the total number of characters (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
putc()
int putc (int c, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a character to a specified file stream.
Parameters:
c | Indicates the int promotion of the character to write. |
stream | Indicates the pointer to the file stream. |
Attention:
Returns:
Returns the ASCII code of the character written if the operation is successful; returns EOF otherwise.
putc_unlocked()
int putc_unlocked (int c, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a character to a specified file stream with the thread remains unlocked.
Parameters:
c | Indicates the int promotion of the character to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
This function cannot be used in a multi-thread process because it does not use locking during the call.
Returns:
Returns the ASCII code of the character written if the operation is successful; returns EOF otherwise.
putchar()
int putchar (int c)
Description:
Writes a character into the standard output (stdout).
Parameters:
c | Indicates the int promotion of the character to write. |
Returns:
Returns the ASCII code of the character written if the operation is successful; returns EOF otherwise.
putchar_unlocked()
int putchar_unlocked (int c)
Description:
Writes a character to the stdout with the thread remains unlocked.
Parameters:
c | Indicates the int promotion of the character to write. |
Attention:
This function cannot be used in a multi-thread process because it does not use locking during the call.
Returns:
Returns the ASCII code of the character written if the operation is successful; returns EOF otherwise.
puts()
int puts (const char * s)
Description:
Writes a character string and appends a new-line character to the stdout.
Parameters:
s | Indicates the pointer to the start address of the output buffer. |
Returns:
Returns a non-negative value if the operation is successful; returns EOF otherwise.
putw()
int putw (int w, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Writes a word (an int value) to a specified file stream.
Parameters:
w | Indicates the word to write. |
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
This function is provided for compatibility with SVR4. You are advised to use fwrite instead.
Returns:
Returns 0 if the operation is successful; returns EOP otherwise.
pwritev()
ssize_t pwritev (int fd, const struct iovec * iov, int iovcnt, off_t offset )
Description:
Writes the data of a multi-group buffer space pointed to by iov to the offset of fd.
Parameters:
fd | Indicates the file descriptor. |
iov | Indicates the pointer to the multi-group buffer. |
iovcnt | Indicates the number of buffers. For details, see IOV_MAX. |
offset | Indicates the offset of the file descriptor to write. |
Returns:
Returns the number of bytes written if the operation is successful; returns -1 and sets errno to a value if the operation fails. If errno is set to EINVAL, the sum of the iov_len values overflows an ssize_t value, or the vector count iovcnt is less than 0 or greater than the permitted maximum.
readv()
ssize_t readv (int fd, const struct iovec * iov, int iovcnt )
Description:
Reads the data of fd to iov.
Parameters:
fd | Indicates the file descriptor. |
iov | Indicates the pointer to the multi-group buffer. |
iovcnt | Indicates the number of buffers. For details, see IOV_MAX. |
Returns:
Returns the number of bytes read if the operation is successful; returns -1 and sets errno to a value if the operation fails. If errno is set to EINVAL, the sum of the iov_len values overflows an ssize_t value, or the vector count iovcnt is less than 0 or greater than the permitted maximum.
remove()
int remove (const char * pathname)
Description:
Deletes a specified file or directory from the file system.
Parameters:
pathname | Indicates the pointer to the file or directory to delete. |
Attention:
This function can NOT be used in the PROC file system.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The length of pathname is greater than NAME_MAX. |
|
The file or directory pointed to by pathname does not exist. |
|
The path is a mount point or is neither a directory nor a file. |
|
When pathname points to a directory, the directory is not empty. |
|
The search permission on the path prefix component is denied, or the write permission of the directory in the path is denied. |
rename()
int rename (const char * oldpath, const char * newpath )
Description:
Renames a specified file.
Parameters:
oldpath | Indicates the pointer to the old path name of the file to rename. |
newpath | Indicates the pointer to the new path name of the file. |
Attention:
This function can NOT be used in the PROC file system.
Returns:
Returns 0 if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
The device or resource is in use by the system or another process. |
|
rewind()
void rewind ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream)
Description:
Sets the position indicator of a specified stream to the beginning of the file.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
scanf()
int scanf (const char * format, ... )
Description:
Reads formatted data from the stdin and stores the data to the additional arguments based on format.
Parameters:
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Attention:
The type of each argument must match a format specifier in format.
Returns:
Returns the number of variables that are successfully read. If the matching fails quickly, the return value may be less than the number of members in the argument list or even zero. If no complete conversion format is available or the input format fails to be matched, EOF is returned. The return value is also EOF if a reading error occurs. If the number of arguments exceeds the number of the format specifiers, the excess arguments are ignored.
select()
int select (int nfds, [fd_set]($api-api-SmartVision-Devices-fd_set.md) *__restrict readfds, [fd_set]($api-api-SmartVision-Devices-fd_set.md) *__restrict writefds, [fd_set]($api-api-SmartVision-Devices-fd_set.md) *__restrict exceptfds, struct [timeval]($api-api-SmartVision-Devices-timeval.md) *__restrict timeout )
Description:
Monitors the I/O events of multiple file descriptors.
Parameters:
nfds | Indicates the maximum value of the file descriptor of the int type. |
readfds | Indicates the descriptor set of the readable event to observe, which is the fd_set type. |
writefds | Indicates the descriptor set of the writable event to observe, which is the fd_set type. |
exceptfds | Indicates the descriptor set of exception event to observe, which is the fd_set type. |
timeout | Indicates the timeout interval, which is the struct timeval type. |
Returns:
Returns the total number of file descriptors of the observed events (that is, the sum of all file descriptors in readfds, writefds, and exceptfds) if the operation is successful; returns -1 and sets errno to a value in the following table if the operation fails.
setbuf()
void setbuf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, char * buf )
Description:
Sets a buffer to be used by a specified stream.
Parameters:
stream | Indicates the pointer to the file object that identifies a stream. |
buf | Indicates the pointer to the start address of the buffer. |
Attention:
When the input parameter buf is not null, the buffer mode is _IOFBF. The default buffer size is determined by the value of BUFSIZ defined in this file. When buf is null, the buffer mode is _IONBF (unbuffered).
setbuffer()
void setbuffer ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * f, char * buf, size_t size )
Description:
Sets the buffer for a specified file stream.
Parameters:
f | Indicates the pointer to the file object that identifies a stream to set. |
buf | Indicates the pointer to the buffer to set. |
size | Indicates the buffer size. |
setlinebuf()
void setlinebuf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * f)
Description:
Sets the linear buffer for a specified file stream.
Parameters:
f | Indicates the pointer to the file object that identifies a stream to set. |
setlocale()
char* setlocale (int category, const char * locale )
Description:
Sets the current locale information based on input parameters.
If locale is NULL, it can be used to obtain the current region settings.
Parameters:
category | Indicates the type of locale information used to set the impact scope of region settings. The value can be LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, or LC_ALL. The region settings include the date format, numeric format, currency format, character processing, and character comparison. The current region settings can affect only one aspect of the content or all the content. |
locale | Indicates the string containing region names. These names are system-specific, but at least the following three language environments must exist: |
Returns:
Returns a pointer to the string representation of the language environment set for the type if the operation is successful; returns a null pointer and the locale is not changed if the operation fails.
setvbuf()
int setvbuf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, char * buf, int mode, size_t size )
Description:
Sets the mode and size of the buffer for a specified stream.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
snprintf()
int snprintf (char * str, size_t size, const char * format, ... )
Description:
Prints formatted data of a maximum of size bytes from a variable argument list to a specified string.
Parameters:
str | Indicates the pointer to the string to which the data is to be written. |
size | Indicates the maximum length of the destination string. |
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Attention:
This function can write a maximum of size-1 valid characters to the destination string.
Returns:
Returns the number of formatted characters written (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise. If the return value is a non-negative value smaller than the value of size, the string has been completely written.
sprintf()
int sprintf (char * str, const char * format, ... )
Description:
Prints formatted data from a variable argument list to a specified string.
Parameters:
str | Indicates the pointer to the string to which the data is to be written. |
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Returns:
Returns the total number of characters (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
sscanf()
int sscanf (const char * str, const char * format, ... )
Description:
Reads data from a character string pointed to by str and stores it based on format into the locations pointed to by the variable arguments.
Parameters:
str | Indicates the pointer to the character string to read. |
format | Indicates the pointer to the format string. |
… | Indicates the list of arguments corresponding to the format specifiers. |
Attention:
An asterisk (*) right after the percent symbol (such as %*d and %*s) in the format denotes that the value for the format will be read but will not be stored into a variable.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when characters are parsed, this function sets errno to EILSEQ.
tempnam()
char* tempnam (const char * dir, const char * prefix )
Description:
Creates a temporary file with a unique file name.
Parameters:
dir | Indicates the pointer to directory for creating the temporary file. |
prefix | Indicates the pointer to the prefix of the file name. |
Attention:
Do not use this function. Use mkstemp() or tmpfile() instead.
Returns:
Returns the pointer to the unique name of the created temporary file if the operation is successful; returns NULL and sets errno to indicate an error otherwise.
See also:
mkstemp() | tmpfile()
ungetc()
int ungetc (int c, [FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream )
Description:
Pushes a character back into a specified file stream.
This function is usually used together with getc.
Parameters:
c | Indicates the int promotion of the character to be pushed back. |
stream | Indicates the pointer to the file object that identifies a stream. |
Attention:
The pushed characters are returned in reverse order if multiple characters are pushed back. Only one pushback is guaranteed.
Returns:
Returns the character specified in c if the operation is successful; returns EOF otherwise.
vasprintf()
int vasprintf (char ** strp, const char * fmt, va_list ap )
Description:
Prints formatted data from a variable argument list to a specified character string.
If the length of the string is uncertain, this function applies for sufficient memory space based on the length of the formatted character string.
Parameters:
Attention:
If strp is no longer used, the applied space must be released.
Returns:
Returns the number of output characters if the operation is successful; returns -1 otherwise.
vdprintf()
int vdprintf (int fd, const char * format, va_list ap )
Description:
Prints formatted data from a variable argument list to a specified file.
Parameters:
fd | Indicates the file descriptor that identifies a file. |
format | Indicates the pointer to the format string. |
ap | Indicates a value identifying a variable argument list initialized by using va_start. |
Returns:
Returns the total number of written characters if the operation is successful; returns a negative value otherwise.
verr()
void verr (int eval, const char * fmt, va_list args )
Description:
Displays error information.
This function outputs the executable file name argv[0] and the accepted second formal parameter to stderr.
Parameters:
eval | This function does not return, but exits with the value of eval. |
fmt | Indicates the pointer to the string to format. |
args | Indicates the parameters initialized by using va_start. |
verrx()
void verrx (int eval, const char * fmt, va_list args )
Description:
Displays a formatted error message.
Parameters:
eval | This function does not return, but exits with the value of eval. |
fmt | Indicates the pointer to the string to format. |
args | Indicates the parameters initialized by using va_start. |
vfprintf()
int vfprintf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const char * format, va_list ap )
Description:
Prints formatted data from a variable argument list to a specified file stream.
Parameters:
Attention:
This function is generally used together with va_start and va_end.
Returns:
Returns the total number of characters (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
vfscanf()
int vfscanf ([FILE]($api-api-SmartVision-Devices-IO.md#ga912af5ab9f8a52ddd387b7defc0b49f1) * stream, const char * format, va_list ap )
Description:
Reads data from a specified file stream and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap.
Parameters:
Attention:
This function is generally used together with va_start and va_end.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when characters are parsed, this function sets errno to EILSEQ.
vprintf()
int vprintf (const char * format, va_list ap )
Description:
Prints formatted data from a variable argument list to the stdout.
Parameters:
format | Indicates the pointer to the format string. |
ap | Indicates a value identifying a variable argument list initialized by using va_start. |
Attention:
This function is generally used together with va_start and va_end.
Returns:
Returns the total number of characters (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
vscanf()
int vscanf (const char * format, va_list ap )
Description:
Reads data from the stdin and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap.
Parameters:
format | Indicates the pointer to the format string. |
ap | Indicates a value identifying a variable argument list initialized by using va_start. |
Attention:
This function is generally used together with va_start and va_end.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when characters are parsed, this function sets errno to EILSEQ.
vsnprintf()
int vsnprintf (char * str, size_t size, const char * format, va_list ap )
Description:
Prints formatted data of a maximum of size bytes from a variable argument list to a specified string.
Parameters:
Attention:
This function can write a maximum of size-1 characters to the destination string.
Returns:
Returns the number of formatted characters written (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise. If the return value is a non-negative value smaller than the value of size, the string has been completely written.
vsprintf()
int vsprintf (char * str, const char * format, va_list ap )
Description:
Prints formatted data from a variable argument list to a specified string.
Parameters:
Returns:
Returns the total number of characters written (excluding the terminating null character ‘\0’) if the operation is successful; returns a negative value otherwise.
vsscanf()
int vsscanf (const char * str, const char * format, va_list ap )
Description:
Reads data from a specified string and stores it based on format into the locations pointed to by the elements in the variable argument list identified by ap.
Parameters:
str | Indicates the pointer to the character string to read. |
format | Indicates the pointer to the format string. |
ap | Indicates a value identifying a variable argument list initialized by using va_start. |
Attention:
This function is generally used together with va_start and va_end.
Returns:
Returns the number of fields successfully assigned to the argument list if the operation is successful; returns 0 if no fields are assigned; returns EOF if a reading error occurs or the end-of-file is reached during data reading. If an encoding error occurs when characters are parsed, this function sets errno to EILSEQ.
vwarn()
void vwarn (const char * fmt, va_list args )
Description:
Displays a formatted error message on the stderr output.
If the fmt parameter is not NULL, stderr displays the error code description obtained from strerror(errno), followed by a space and a colon (:), and the error message to print.
Parameters:
fmt | Indicates the pointer to the string to format. |
args | Indicates the parameters initialized by using va_start. |
vwarnx()
void vwarnx (const char * fmt, va_list args )
Description:
Displays a formatted error message on the stderr output.
If the fmt parameter is not NULL, stderr displays the error code description obtained from strerror(errno), followed by a space and a colon (:), and the error message to print.
Parameters:
fmt | Indicates the pointer to the string to format. |
args | Indicates the parameters initialized by using va_start. |
warn()
void warn (const char * fmt, ... )
Description:
Displays a formatted error message on the standard error (stderr) output.
If the fmt parameter is not NULL, stderr displays the error code description obtained from strerror(errno), followed by a space and a colon (:), and the error message to print.
Parameters:
fmt | Indicates the pointer to the string to format. |
… | Indicates the parameters corresponding to the format declaration. |
warnx()
void warnx (const char * fmt, ... )
Description:
Displays a formatted error message on the stderr output.
If the fmt parameter is not NULL, stderr displays the error code description obtained from strerror(errno), followed by a space and a colon (:), and the error message to print.
Parameters:
fmt | Indicates the pointer to the string to format. |
… | Indicates the parameters corresponding to the format declaration. |
wordfree()
void wordfree ([wordexp_t]($api-api-SmartVision-Devices-wordexp_t.md) * we)
Description:
Frees a word expansion buffer.
Parameters:
we | Indicates the pointer to the word expansion buffer to free. |
writev()
ssize_t writev (int fd, const struct iovec * iov, int iovcnt )
Description:
Writes a given length of data into a file.
This function is used to write the iovcnt length of iov to fd.
Parameters:
fd | Indicates the file descriptor. |
iov | Indicates the pointer to the multi-group buffer. |
iovcnt | Indicates the number of buffers. For details, see IOV_MAX. |
Returns:
Returns the number of bytes written if the operation is successful; returns -1 and sets errno to a value if the operation fails. If errno is set to EINVAL, the sum of the iov_len values overflows an ssize_t value, or the vector count iovcnt is less than 0 or greater than the permitted maximum.