This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I'm trying to write to and then read from a binary file. I have 2 .java files. The first one writes to and the 2nd one reads from. I wrote to the file and now I'm testing my read program and here's the output i'm getting...
I should say that there should be 4 fields printing out: state, an int called FIPS, another int called population and the name of the town ( a string). I have no idea what that really long number is in the beginning of each line.
You say that the output from the first program is not what you expected. Then you say your second program, which expects the CORRECT output from the first program, is not working correctly. I'd say that your problem is in the first program. Binary files aren't ment to be read in a text editor, so don't get freaked by the weird characters. If you really want to understand the data, use a hex editor. BTW, use code tags (the buttons under the edit window on the post page) to preserve the formatting of your code. And remove the extra line feeds. Most people here won't read more than 20 or so lines of code, so if it's at all possible, narrow down where your problem is.