首页 文章
  • 486 votes
     answers
     views

    为什么“while(!feof(file))”总是错的?

    我看到人们最近在很多帖子中试图读取这样的文件 . Code #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char * path = argc > 1 ? argv[1] : "input.txt"; FILE * fp = fo...
  • 3 votes
     answers
     views

    PHP feof()在文件结束前返回true

    在feof()函数在文件结束之前返回true的最后几天,我一直在研究一个奇怪的PHP问题 . 下面是我的代码的框架: $this->fh = fopen("bigfile.txt", "r"); while(!feof($this->fh)) { $dataString = fgets($this->fh); i...
  • 0 votes
     answers
     views

    C - 程序无法正确读取文件结尾[重复]

    这个问题在这里已有答案: Why is “while ( !feof (file) )” always wrong? 5个答案 我正在尝试制作一组基本程序,其中一个程序要求用户提供一组值,程序将这些值写入文件,另一个程序从文件中读取值并将其打印到屏幕上 . 这是我的代码: #include <stdio.h> #include <stdlib.h> int main(...
  • 0 votes
     answers
     views

    调用fread()函数时文件指针如何移动? [重复]

    这个问题在这里已有答案: Why is “while ( !feof (file) )” always wrong? 5个答案 //Libraries are called accordingly struct std { int a; char b; }// a structure with 2 objects void main() { std h[5]; // struc...
  • 0 votes
     answers
     views

    使用do while循环到输入文件中的下一行

    基本上我想要做的是使用数组和strtok从我工作的输入文件中提取时间和IP地址 . 我的问题是输入文件是一个很长的列表,我需要为.txt文件中的每一行执行此操作,但每当我尝试将我的代码放入带有feof(input_poiter)的do while循环时,它将不再执行一次,继承人我所拥有的; #include <stdlib.h> #include <string.h> #i...

热门问题