IO笔记新增

1  ftell()用于取得当前文件位置,成功为当前文件位置指示,失败为-1L。

2  int fseek(FILE* stream, long offset, int whence) 的whence 参数:

  SEEK_SET/SEEK_CUR/SEEK_END

3  rewind()等价于(void)fseek(stream,0L,SEEK_SET)

4  判断文件是否结束:

    int cTemp;

    while(!feof(fp)&&!ferror(stdin))

    {cTemp = fgetc(fp);}

5  打印时间(或者直接用ctime(&t))

  time_t t = time(NULL);

  struct tm * ttt = localtime(&t);

  printf("%02d:%02d%02d",ttt->tm_hour,ttt->tm_min,ttt->tm_sec);

6  struct passwd *getpwuid(uid_t uid);

   struct group *getgrgid(gid_t gid);

7  获取目录下的名称:

  DIR *dp = opendir(".");

  struct dirent *p = readdir(dp);

  printf("%s ",p->d_name);

原文地址:https://www.cnblogs.com/oyjngz101/p/6020742.html