Closing Files

Discussion in 'Java' started by E Tepp, Feb 2, 2004.

  1. E Tepp

    E Tepp Guest


    I have a program that opens a file for writing at one part, closes it
    and then opens it again later for read. Although it works 99% of the
    time, once in a while the file does not close correctly, at least I
    think this is the problem.
    The next time it reads the file it read in words with space between
    each letter. For example "Hello" in the file will be read as "H e l l
    o". Even on reboot the file remains open. When I delete the file and
    make a now one the problem is fixed. Does anyone know how to prevent
    this from happening, or at least fix it.

    Thank You,
    E Tepp, Feb 2, 2004
    1. Advertisements

  2. Spaces or nulls? If the latter, it sounds as if the encoding it's being
    written in gets fouled up, and the program is writing 2-byte UTF-16
    characters instead of single-byte UTF-8 or ASCII.
    Mike Schilling, Feb 2, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.