1 Star 0 Fork 4.9K

平凡 / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
stdio-h.md 51.10 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

stdio.h

Overview

Related Modules:

IO

Description:

Declares common functions used for performing input and output (I/O) operations.

You can use the functions provided in this file to perform the I/O operations required during development. Distinguished by I/O targets, there are standard I/O, file stream I/O, and string I/O.

Since:

1.0

Version:

1.0

Summary

Typedefs

Typedef Name

Description

FILE

typedef struct _IO_FILE 

Struct of file stream.

Functions

Function Name

Description

fopen (const char *__restrict path, const char *__restrict mode)

FILE

Opens the file stored in the specified path based on the given mode.

fclose (FILE *fd)

int 

Closes a file based on the specified file descriptor.

remove (const char *pathname)

int 

Deletes a specified file or directory from the file system.

rename (const char *oldpath, const char *newpath)

int 

Renames a specified file.

feof (FILE *fp)

int 

Tests the end-of-file indicator for a specified stream.

ferror (FILE *stream)

int 

Tests for the error identifier of a specified file stream.

fflush (FILE *fp)

int 

Flushes the output buffer of a specified stream.

clearerr (FILE *fp)

void 

Resets the error indicators.

fseek (FILE *fp, long offset, int whence)

int 

Changes the position of a specified stream to a new position.

ftell (FILE *fp)

long 

Obtains the current value of the file position indicator for a specified file stream.

rewind (FILE *stream)

void 

Sets the position indicator of a specified stream to the beginning of the file.

fgetpos (FILE *stream, fpos_t *pos)

int 

Obtains the current file position of a specified stream and writes it to the pos parameter.

fsetpos (FILE *fp, const fpos_t *pos)

int 

Sets the file position indicator for a specified file stream.

fread (void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)

size_t 

Reads data from a specified stream.

fwrite (const void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)

size_t 

Writes data to a specified stream.

getc (FILE *stream)

int 

Reads a character from a specified file stream.

getchar (void)

int 

Obtains the next character from the standard input (stdin).

ungetc (int c, FILE *stream)

int 

Pushes a character back into a specified file stream.

fputc (int c, FILE *stream)

int 

Writes a character into the position pointed to by a specified stream.

putc (int c, FILE *stream)

int 

Writes a character to a specified file stream.

putchar (int c)

int 

Writes a character into the standard output (stdout).

fgets (char *s, int size, FILE *stream)

char * 

Reads a line of characters from a specified file stream and stores it into the string pointed to by s.

gets (char *s)

char * 

Reads a line of characters from the stdin and stores it in the buffer.

fputs (const char *s, FILE *stream)

int 

Writes a character string (excluding the terminating null character) to a specified file stream.

puts (const char *s)

int 

Writes a character string and appends a new-line character to the stdout.

printf (const char *format,...)

int 

Formats arguments based on format and prints formatted data to the stdout.

fprintf (FILE *stream, const char *format,...)

int 

Formats arguments based on format and prints formatted data to a specified file stream.

sprintf (char *str, const char *format,...)

int 

Prints formatted data from a variable argument list to a specified string.

snprintf (char *str, size_t size, const char *format,...)

int 

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)

int 

Prints formatted data from a variable argument list to the stdout.

vfprintf (FILE *stream, const char *format, va_list ap)

int 

Prints formatted data from a variable argument list to a specified file stream.

vsprintf (char *str, const char *format, va_list ap)

int 

Prints formatted data from a variable argument list to a specified string.

vsnprintf (char *str, size_t size, const char *format, va_list ap)

int 

Prints formatted data of a maximum of size bytes from a variable argument list to a specified string.

scanf (const char *format,...)

int 

Reads formatted data from the stdin and stores the data to the additional arguments based on format.

fscanf (FILE *stream, const char *format,...)

int 

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,...)

int 

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)

int 

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.

vfscanf (FILE *stream, const char *format, va_list ap)

int 

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)

int 

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)

void 

Prints the last error occurred during a call to a system or library function to the standard error output stream (stderr).

setvbuf (FILE *stream, char *buf, int mode, size_t size)

int 

Sets the mode and size of the buffer for a specified stream.

setbuf (FILE *stream, char *buf)

void 

Sets a buffer to be used by 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)

FILE

Opens a stream for writing to a specified buffer.

pclose (FILE *f)

int 

Closes a specified pipe.

fileno (FILE *fp)

int 

Obtains the file descriptor of a specified file stream.

fseeko (FILE *fp, off_t offset, int whence)

int 

Sets the position of the next input or output operation on a specified file stream.

ftello (FILE *fp)

off_t 

Obtains the current value of the file position indicator for a specified file stream.

dprintf (int fd, const char *format,...)

int 

Prints formatted data to a specified file.

vdprintf (int fd, const char *format, va_list ap)

int 

Prints formatted data from a variable argument list to a specified file.

ftrylockfile (FILE *filehandle)

int 

Locks a specified file.

funlockfile (FILE *filehandle)

void 

Unlocks a specified file.

getc_unlocked (FILE *stream)

int 

Obtains a character from a specified file stream without locking the file stream or checking whether it is locked.

getchar_unlocked (void)

int 

Obtains the next character from stdin.

putc_unlocked (int c, FILE *stream)

int 

Writes a character to a specified file stream with the thread remains unlocked.

putchar_unlocked (int c)

int 

Writes a character to the stdout with the thread remains unlocked.

getdelim (char **lineptr, size_t *n, int delim, FILE *stream)

ssize_t 

Reads an entire line from a specified file stream.

getline (char **lineptr, size_t *n, FILE *stream)

ssize_t 

Reads an entire line from a specified file stream.

tempnam (const char *dir, const char *prefix)

char * 

Creates a temporary file with a unique file name.

setbuffer (FILE *f, char *buf, size_t size)

void 

Sets the buffer for a specified file stream.

setlinebuf (FILE *f)

void 

Sets the linear buffer for a specified file stream.

fgetc (FILE *stream)

int 

Reads a character from the file pointed to by stream.

fgetc_unlocked (FILE *stream)

int 

Reads a character from the file pointed to by stream with the thread remains unlocked.

fputc_unlocked (int c, FILE *stream)

int 

Writes a character to the file stream pointed to by stream at the current position.

ferror_unlocked (FILE *stream)

int 

Tests for the error identifier of a specified file stream.

getw (FILE *stream)

int 

Reads a word (an int value) from a specified file stream.

putw (int w, FILE *stream)

int 

Writes a word (an int value) to a specified file stream.

fgetln (FILE *stream, size_t *len)

char * 

Reads a line of data from the current position of a specified file stream.

asprintf (char **strp, const char *fmt,...)

int 

Prints formatted data to a specified character string.

vasprintf (char **strp, const char *fmt, va_list ap)

int 

Prints formatted data from a variable argument list to a specified character string.

1
https://gitee.com/pingfan_vs_hs/docs.git
git@gitee.com:pingfan_vs_hs/docs.git
pingfan_vs_hs
docs
docs
master

搜索帮助