You should try to replace fp = fopen(argv[1], "r"); by fp = fopen(argv[1], "rb"); when compiling on windows If this works, I'll tell you why...
Forum Rules