-
Hidden eof in a file
Hi All,
I am in the process of converting from one interface program to a different interface program. Rather then spend several hours for each interface I am attempting to write a program that strips the rules of the interface and dumps them to the screen. My code is written in m$ C console app. When I open the input file it finds a fake EOF and stops processing. Any thoughts? I checked the file in a HEX editor and removed 00 E0 entries (EOF) but still the program fails. Source code and input file attached.
-
I ported the code to Unix and now it works fine and skips the hidden EOF -for my own curiousity I would like to know what is tripping me up on the wintel package.
Thanks,
-D
-
Code problems
It's possible I'm just missing one, but check your brackets. I know that's what caused fake EOF errors for me in my programming classes.
-Keisha
-
Thanks for the suggestion but if my brackets were off I would think the results would be the same in unix.
-D
-
I just d/led your zip and saw that in map.c you havent put " return 0; " at the end.
-
well the difference in how it runs could probably be accounted for by the use of different compilers.
what did you use to compile it on the wintell box? have you tried other compilers(like borlan's free compiler if you use an MS compiler).
it might just be a difference in how it gets compiled(which shouldnt happen if everybody really followed the standards, but they dont so it does).
-
Quote:
Originally posted here by ihsir
I just d/led your zip and saw that in map.c you havent put " return 0; " at the end.
well, while he should put that at the end, that should have no bearing on the actuall bug he is working with here, and usually really doesnt cause any problems.
-
I only have access to the m$ compiler at work. I got it working on the Unix level which means all the files I want to translate must be ftped to Unix -not that much additional work (more of an annoyance). I will add the return 0. Not sure why !feof is getting tripped up. Whatever the charecter is it also kills fgetc(fp) since I tried looping through the file using the file size asthe control ( I think it was something like fileLenght = flenght(fp))
Thanks for all the suggestions,
-D
-
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...
-
Thanks erikjacobsen. It worked with the "rb" -I had forgotten about the binary option.
Cheers,
-D
-
Great - saves me from explaining why