stdio.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef __STDIO_H__
  2. #define __STDIO_H__
  3. #include <stdarg.h> /* va_list, va_arg() */
  4. #include <stddef.h> /* size_t */
  5. #include <stdlib.h>
  6. //#include <dirent.h>
  7. // FIXME: find a right place to define the following things
  8. // constants
  9. typedef int fpos_t;
  10. #define FSEEK_SET 0 // origin is beginning of the file
  11. #define FSEEK_CUR 1 // origin is current position
  12. #define FSEEK_END 2 // origin is end of the file
  13. typedef unsigned long FILE;
  14. typedef int time_t;
  15. struct stat {
  16. int st_dev; /* ID of device containing file */
  17. int st_ino; /* inode number */
  18. int st_mode; /* protection */
  19. int st_size; /* total size, in bytes */
  20. int st_blksize; /* blocksize for file system I/O */
  21. int st_blocks; /* number of 512B blocks allocated */
  22. time_t st_atime; /* time of last access */
  23. time_t st_mtime; /* time of last modification */
  24. time_t st_ctime; /* time of last status change */
  25. };
  26. #define stdin ((void*)0)
  27. #define stdout ((void*)0)
  28. #define stderr ((void*)0)
  29. #define EOF (-1)
  30. int vsprintf(char *buffer, const char *fmt, va_list args);
  31. int sprintf(char *buffer, const char *fmt, ...);
  32. int vprintf(const char *fmt, va_list args);
  33. int printf(const char *fmt, ...);
  34. int fprintf(FILE *stream, const char *format, ...);
  35. int fgetc(FILE *stream);
  36. char *fgets(char *s, int size, FILE *stream);
  37. int getc(FILE *stream);
  38. int getchar(void);
  39. char *gets(char *s);
  40. int ungetc(int c, FILE *stream);
  41. int fputc(int c, FILE *stream);
  42. int fputs(const char *s, FILE *stream);
  43. int putc(int c, FILE *stream);
  44. int putchar(int c);
  45. int puts(const char *s);
  46. FILE *fopen(const char *path, const char *mode);
  47. FILE *fdopen(int fd, const char *mode);
  48. FILE *freopen(const char *path, const char *mode, FILE *stream);
  49. int fclose(FILE *fp);
  50. size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
  51. size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
  52. struct dir *opendir(const char *path);
  53. struct dirent *readdir(struct dir *dirp);
  54. int closedir(struct dir *dirp);
  55. int fstat(FILE* fd, struct stat *buf);
  56. #endif /* __STDIO_H__ */