stdio.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. filesummary.CH: 提供对IO的支持,对文件的流式操作和IO文件常量
  3. filesummary.EN: Provide IO support, included stream operations and IO constant
  4. CH: 打印format,其中的占位符(%)用参数列表中的值替换
  5. EN: Print format, replace % in argument table value
  6. format.CH: 可能包含格式化说明符的要打印的字符串
  7. format.EN: Format expression to print
  8. arg1.CH: 参数列表
  9. arg1.EN: Argument table
  10. */
  11. void printf(char *format, ...);
  12. /*
  13. CH: 扫描stdin,其中的占位符(%)将填入参数列表中的变量
  14. EN: Scan stdin, % will fill argument table variable
  15. format.CH: 包含格式化说明符的字符串
  16. format.EN: Format expression to scan
  17. arg1.CH: 参数列表
  18. arg1.EN: Argument table
  19. */
  20. void scanf(char *format, ...);
  21. /*
  22. CH: 读取一行文本,填入字符串
  23. EN: Scan a line, fill toString
  24. toString.CH: 要填入的字符串
  25. toString.EN: String to fill
  26. */
  27. char* gets(char *toString);
  28. /*
  29. CH: 从stdin读取下一个字符
  30. EN: Read next character in stdin
  31. */
  32. int getchar();
  33. /*
  34. CH: 表示大小的整数类型
  35. EN: Integer type representing size
  36. */
  37. typedef builtin size_t;
  38. /*
  39. CH: 表示指针空或整数0
  40. EN: Representing null pointer or integer 0
  41. */
  42. builtin NULL;
  43. /*
  44. CH: 表示文件结尾的字符
  45. EN: Character representing end of file
  46. */
  47. builtin EOF;
  48. /*
  49. CH: 向stdout打印char
  50. EN: Print char to stdout
  51. char.CH: 要打印的字符
  52. char.EN: char to print
  53. */
  54. int putchar(int char);
  55. /*
  56. CH: 向stdout打印字符串
  57. EN: Print string to stdout
  58. string.CH: 要打印的字符串
  59. string.EN: String to print
  60. */
  61. int puts(char *string);
  62. /*
  63. CH: 表示文件的类型
  64. EN: Type representing file
  65. */
  66. typedef builtin FILE;
  67. /*
  68. CH: 表示文件的类型
  69. EN: Type representing file
  70. */
  71. typedef FILE File;
  72. /*
  73. CH: 表示文件流位置的类型
  74. EN: Type representing file stream position
  75. */
  76. typedef builtin fpos_t;
  77. /*
  78. CH: 表示标准输入流(控制台输入文件)
  79. EN: Representing standard input stream (Terminal input file)
  80. */
  81. FILE* stdin;
  82. /*
  83. CH: 表示标准输出流(控制台输出文件)
  84. EN: Representing standard output stream (Terminal output file)
  85. */
  86. FILE* stdout;
  87. /*
  88. CH: 表示标准错误流(控制台输出文件),在此App运行时等同于stdout
  89. EN: Representing standard error stream (Terminal output file), alias to stdout in this App
  90. */
  91. FILE* stderr;
  92. /*
  93. CH: 用指定的方式打开硬盘文件,在此App中可以打开的文件仅限于项目中的.txt
  94. EN: Open disk file using specified mode, in this app you only can open .txt file in project
  95. file.CH: 文件名
  96. file.EN: file name
  97. mode.CH: 模式说明符
  98. mode.EN: Description mode
  99. */
  100. FILE* fopen(char *file, char *mode);
  101. /*
  102. CH: 关闭文件流
  103. EN: Close file stream
  104. file.CH: 文件
  105. file.EN: File
  106. */
  107. void fclose(FILE *file);
  108. /*
  109. CH: 刷新文件流
  110. EN: Flush file stream
  111. file.CH: 文件
  112. file.EN: File
  113. */
  114. void fflush(FILE *file);
  115. /*
  116. CH: 向文件中打印字符
  117. EN: Print ch to file
  118. ch.CH: 要打印的字符
  119. ch.EN: Char to print
  120. file.CH: 文件
  121. file.EN: File
  122. */
  123. void fputc(char ch, FILE *file);
  124. /*
  125. CH: 从文件中读取字符
  126. EN: Scan ch from file
  127. file.CH: 文件
  128. file.EN: File
  129. */
  130. char fgetc(FILE *file);
  131. /*
  132. CH: 向文件中读取字符
  133. EN: Scan ch from file
  134. ch.CH: 要打印的字符
  135. ch.EN: Char to print
  136. file.CH: 文件
  137. file.EN: File
  138. */
  139. void putc(char ch, FILE *file);
  140. /*
  141. CH: 从文件中读取字符
  142. EN: Scan ch from file
  143. file.CH: 文件
  144. file.EN: File
  145. */
  146. char getc(FILE *file);
  147. /*
  148. CH: 设置文件流位置
  149. EN: Set the stream position for file stream
  150. file.CH: 文件
  151. file.EN: File
  152. pos.CH: 文件位置
  153. pos.EN: File position
  154. */
  155. int fsetpos(FILE *file, fpos_t *pos);
  156. /*
  157. CH: 获取文件流位置
  158. EN: Get the stream position for file stream
  159. file.CH: 文件
  160. file.EN: File
  161. pos.CH: 文件位置
  162. pos.EN: File position
  163. */
  164. int fgetpos(FILE *file, fpos_t *pos);
  165. /*
  166. CH: 测试文件是否已经达到末尾
  167. EN: Get is the stream position is end of file
  168. file.CH: 文件
  169. file.EN: File
  170. */
  171. int feof(FILE *file);
  172. /*
  173. CH: 向文件打印format,其中的占位符(%)用参数列表中的值替换
  174. EN: Print format to file, replace % in argument table value
  175. file.CH: 文件
  176. file.EN: File
  177. format.CH: 可能包含格式化说明符的要打印的字符串
  178. format.EN: Format expression to print
  179. arg1.CH: 参数列表
  180. arg1.EN: Argument table
  181. */
  182. int fprintf(FILE *file, char *format, ...);
  183. /*
  184. CH: 扫描文件,其中的占位符(%)将填入参数列表中的变量
  185. EN: Scan file, % will fill argument table variable
  186. file.CH: 文件
  187. file.EN: File
  188. format.CH: 包含格式化说明符的字符串
  189. format.EN: Format expression to scan
  190. arg1.CH: 参数列表
  191. arg1.EN: Argument table
  192. */
  193. int fscanf(FILE *file, char *format, ...);
  194. size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
  195. size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
  196. /*
  197. CH: 将流位置设置流的开头
  198. EN: Set the stream position to first position
  199. stream.CH: 指定流
  200. stream.EN: Specified stream
  201. */
  202. void rewind(FILE *stream);
  203. /*
  204. CH: 返回指定流的流位置
  205. EN: Returns the position of given stream
  206. stream.CH: 指定流
  207. stream.EN: Specified stream
  208. */
  209. long ftell(FILE *stream);
  210. /*
  211. CH: 从文件读取一行文本,填入字符串
  212. EN: Scan a line from file, fill toString
  213. str.CH: 要填入的字符串
  214. str.EN: String to fill
  215. n.CH: 字符串缓冲区长度
  216. n.EN: String length
  217. stream.CH: 文件
  218. stream.EN: File
  219. */
  220. char fgets(char *str, int n, FILE *stream);