But the file wont even open as it always returns 0 after the first if statement. I have the .bin file in the same directory as the .exe file and i'm currently really confused as to why the file wont open as from looking around on the net this is how you are supposed to open a file for reading.
You should change your code, so that if file isn't opened, it returns something else - like -1 or 1 - so you know that program have not reached its end and terminated too fast.
Then you would know if program really closed because it could not open file, or just went so fast that you couldn't see it.