0

Why does this code result in infinite loop on cLion, while on opening the project on Xcode it works normally and terminates on finding on EOF?

       while (!feof(file)) {
        fscanf(file, "%d", &number);
        printf("%d\t",number);
    }
  • Hard to say when your code is incomplete and you give no indication what options you compiled it with... – Mark Setchell Oct 19 '17 at 10:36
  • It is just a trial in the main function to read integers separated by tabs from a .txt file. – Fady Nabil Yacoub Oct 19 '17 at 10:43
  • Questions are supposed to include a **minimum, complete example** of code that can be compiled and tested. The compiler, compile/link options you use, and the header files you include all make a difference. – Mark Setchell Oct 19 '17 at 10:54

0 Answers0