Feof() false triggering in Windows (C)

So I’ve been writing a program which scans through files that works just fine when compiled with gcc on Linux. But on Windows, with both Microsoft compiler and MinGW, feof() false-triggers. The loop should break once it detects the end statement of the filetype, the feof is only there as a failsafe and never triggers for correct files on Linux…

Does anyone have an Idea what I’m doing wrong?

while(1)
    {
            ...
            //File is read here

            if(feof(in))
            {
                    DEBUG_PRINTF("Reached EOF before IEND\n");
                    break;
            }
    }

Posted this for reference.

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/feof?view=vs-2019

If you are using glibc on linux, https://www.gnu.org/software/libc/manual/html_node/EOF-and-Errors.html, their feof looks like it has the same functionality as Microsoft’s: feof checks the stream, so it returns EOF only after the stream has tried to read past EOF.

Function: int feof *(FILE stream)
Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | See POSIX Safety Concepts.
The feof function returns nonzero if and only if the end-of-file indicator for the stream stream is set.
This symbol is declared in stdio.h.

So you yada yada yada’d some important details for for your issue.