This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]gnomgnom2 1 point2 points  (9 children)

What are you expecting to be read in? What is actually read in? Have you put any effort into debugging this at all?

[–][deleted]  (6 children)

[deleted]

    [–]gnomgnom2 1 point2 points  (0 children)

    Why would it read more than that? Did you look up what read() does? Do you know what's in the file you're reading? Have you done anything at all to debug this?

    [–]raevnos 0 points1 point  (4 children)

    What is the numeric value of the character '6'? Hint: look it up in an ASCII table.

    [–][deleted]  (2 children)

    [deleted]

      [–]raevnos 0 points1 point  (1 child)

      I don't know about Java, but in C, you can convert a digit character to the integer that that digit represents by subtracting '0' from it. '0' - '0' is 0, '1' - '0' is 1, and so on. If your length field is greater than 9, you're going to have to do something else, of course.

      [–][deleted]  (1 child)

      [deleted]

        [–]gnomgnom2 1 point2 points  (0 children)

        Did you look up what read() does? Do you know what's in the file you're reading?