Hidden eof in a file
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Hidden eof in a file

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    420

    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.

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    420
    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
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

  3. #3

    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
    www.notinourname.net
    www.nion.us

    Read them.

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Posts
    420
    Thanks for the suggestion but if my brackets were off I would think the results would be the same in unix.
    -D
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

  5. #5
    Member
    Join Date
    Dec 2001
    Posts
    94
    I just d/led your zip and saw that in map.c you havent put " return 0; " at the end.

  6. #6
    Senior Member
    Join Date
    Aug 2001
    Posts
    356
    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).
    -8-

    There are 10 types of people in this world: those who understand binary, and those who dont.

  7. #7
    Senior Member
    Join Date
    Aug 2001
    Posts
    356
    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.
    -8-

    There are 10 types of people in this world: those who understand binary, and those who dont.

  8. #8
    Senior Member
    Join Date
    Jul 2001
    Posts
    420
    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
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

  9. #9
    Junior Member
    Join Date
    Jul 2002
    Posts
    11
    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...

  10. #10
    Senior Member
    Join Date
    Jul 2001
    Posts
    420
    Thanks erikjacobsen. It worked with the "rb" -I had forgotten about the binary option.

    Cheers,
    -D
    If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
    -- former White House cybersecurity adviser Richard Clarke

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •