char *fgets(char *s, int n, FILE *stream);

int fscanf(FILE *stream, char *format,[argument...]);

 

fgets读入最后的\n,而fscanf不读入。

所以在获得字符串长度是,int len = strlen(s)-1;//fgets对人的

或者int len = strlen(s);//fscanf 读入的

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-01-05
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
相关资源
相似解决方案