⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.c

📁 压缩包里面的都是精致的基本C语言小程序
💻 C
字号:
#include "error.h"#include "mystdlib.h"#include "file.h"file fileOpen (char *fname, char *mode){  file fp = fopen (fname, mode);    if (!fp)    exception ("bad file pointer: file.c\n");  return fp;}int fileClose (file fp){  return fclose (fp);}int fileGetChar (file fp){  return getc (fp);}int filePutChar (int c, file fp){  putc (c, fp);  return c;}str fileGets (file fp){  int maxSize = 1024;  char *temp = checkedMalloc (maxSize * sizeof (char));    if (NULL == fgets (temp, maxSize, fp))  {    //error ("no content in file: file.c\n");    checkedFree (temp);    return NULL;  }  if (!(strValid (temp, maxSize)))    exception ("space too small: file.c\n");  str sss = newStr (temp);  checkedFree (temp);  return sss;}int filePuts (str line, file fp){  char *s = strToCharStar (line);    int i = fputs (s, fp);      if (EOF == i)    error ("file write error: file.c\n");  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -