stdio.h

Provide IO support, included stream operations and IO constant


Type

  typedef builtin size_t;
    Integer type representing size

  typedef builtin FILE;
    Type representing file

  typedef FILE File;
    Type representing file

  typedef builtin fpos_t;
    Type representing file stream position


Function

  int printf(char *format, ... arg1);
    Print format, replace % in argument table value

  int scanf(char *format, ... arg1);
    Scan stdin, % will fill argument table variable

  char* gets(char *toString);
    Scan a line, fill toString

  int getchar();
    Read next character in stdin

  int putchar(int char);
    Print char to stdout

  int puts(char *string);
    Print string to stdout

  FILE* fopen(char *file, char *mode);
    Open disk file using specified mode, in this app you only can open .txt file in project

  void fclose(FILE *file);
    Close file stream

  void fflush(FILE *file);
    Flush file stream

  void fputc(char ch, FILE *file);
    Print ch to file

  char fgetc(FILE *file);
    Scan ch from file

  void putc(char ch, FILE *file);
    Scan ch from file

  char getc(FILE *file);
    Scan ch from file

  int fsetpos(FILE *file, fpos_t *pos);
    Set the stream position for file stream

  int fgetpos(FILE *file, fpos_t *pos);
    Get the stream position for file stream

  int feof(FILE *file);
    Get is the stream position is end of file

  int fprintf(FILE *file, char *format, ... arg1);
    Print format to file, replace % in argument table value

  int fscanf(FILE *file, char *format, ... arg1);
    Scan file, % will fill argument table variable

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

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

  void rewind(FILE *stream);
    Set the stream position to first position

  long ftell(FILE *stream);
    Returns the position of given stream

  char fgets(char *str, int n, FILE *stream);
    Scan a line from file, fill toString

  int sprintf(char *ToPrint, char *Format, ... arg1);
    Print to string

  int snprintf(char *ToPrint, int Sizeof_ToPrint, char *Format, ... arg1);
    Print to string, tell the program string buffer size to avoid write out of bounds

  int sscanf(char *arg1, char *arg2, ... arg3);
    Scan variables in string, behavior like scanf, but doesn't scan stream, instead of scan given string.


Variable

  builtin NULL;
    Representing null pointer or integer 0

  builtin EOF;
    Character representing end of file

  FILE* stdin;
    Representing standard input stream (Terminal input file)

  FILE* stdout;
    Representing standard output stream (Terminal output file)

  FILE* stderr;
    Representing standard error stream (Terminal output file), alias to stdout in this App

头文件

stdio.h

提供对IO的支持,对文件的流式操作和IO文件常量


类型

  typedef builtin size_t;
    表示大小的整数类型

  typedef builtin FILE;
    表示文件的类型

  typedef FILE File;
    表示文件的类型

  typedef builtin fpos_t;
    表示文件流位置的类型


函数

  int printf(char *format, ... arg1);
    打印format,其中的占位符(%)用参数列表中的值替换

  int scanf(char *format, ... arg1);
    扫描stdin,其中的占位符(%)将填入参数列表中的变量

  char* gets(char *toString);
    读取一行文本,填入字符串

  int getchar();
    从stdin读取下一个字符

  int putchar(int char);
    向stdout打印char

  int puts(char *string);
    向stdout打印字符串

  FILE* fopen(char *file, char *mode);
    用指定的方式打开硬盘文件,在此App中可以打开的文件仅限于项目中的.txt

  void fclose(FILE *file);
    关闭文件流

  void fflush(FILE *file);
    刷新文件流

  void fputc(char ch, FILE *file);
    向文件中打印字符

  char fgetc(FILE *file);
    从文件中读取字符

  void putc(char ch, FILE *file);
    向文件中读取字符

  char getc(FILE *file);
    从文件中读取字符

  int fsetpos(FILE *file, fpos_t *pos);
    设置文件流位置

  int fgetpos(FILE *file, fpos_t *pos);
    获取文件流位置

  int feof(FILE *file);
    测试文件是否已经达到末尾

  int fprintf(FILE *file, char *format, ... arg1);
    向文件打印format,其中的占位符(%)用参数列表中的值替换

  int fscanf(FILE *file, char *format, ... arg1);
    扫描文件,其中的占位符(%)将填入参数列表中的变量

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

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

  void rewind(FILE *stream);
    将流位置设置流的开头

  long ftell(FILE *stream);
    返回指定流的流位置

  char fgets(char *str, int n, FILE *stream);
    从文件读取一行文本,填入字符串

  int sprintf(char *ToPrint, char *Format, ... arg1);
    打印到字符串

  int snprintf(char *ToPrint, int Sizeof_ToPrint, char *Format, ... arg1);
    打印到字符串,并提前告知字符串缓冲区大小防止越界写入

  int sscanf(char *arg1, char *arg2, ... arg3);
    从字符串中扫描变量,行为类似于scanf,但不从流中扫描而是从给定的字符串中扫描


变量

  builtin NULL;
    表示指针空或整数0

  builtin EOF;
    表示文件结尾的字符

  FILE* stdin;
    表示标准输入流(控制台输入文件)

  FILE* stdout;
    表示标准输出流(控制台输出文件)

  FILE* stderr;
    表示标准错误流(控制台输出文件),在此App运行时等同于stdout