Hi, Welcome to JavaRanch! The DataOutput interface is for doing binary I/O, not human-readable text. The "???" you're seeing are the bits and bytes that represent the numbers internally, the characters you can read. Binary I/O is appropriate for storing data to a compact file or sending it across a network, but not for presenting to a human audience. I could try to critique your code but I think a better thing to do would be to tell you you should use java.io.PrintWriter instead of DataOutputStream, and that you should go to Sun's I/O tutorial to learn the specifics.
Ernest, you are usually on the ball (moreso than I), but this example is FROM the IO Tutorial! The problem in this example is that it writes '\n' as an end-of-line marker but on the read it breaks on '\r' (the Windows line seperator is "\r\n"), leaving the file pointer at '\n', which mucks up the later reads. Change the line char lineSep=System.getProperty("line.separator").charAt(0);
to char lineSep = '\n';
and the example will work fine. [ December 09, 2003: Message edited by: Joe Ess ]