Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Random access files and null bytes(java)

  • 07-03-2005 11:59PM
    #1
    Registered Users, Registered Users 2 Posts: 1,345 ✭✭✭


    Im reading from a random access file in java using the readLine() method.

    Its outputting with null bytes

    Any way of removing these from the string?

    I used the .replace ( author = new String(author).replace( '\0',' '); ) method to replace them with spaces, but then im just left with a string full of spaces.

    I considered removing the spaces, but I want to retain the actual spaces in the string, ie where the break was intended.

    I think my brains just fried, would appreciate any suggestions


Comments

  • Registered Users, Registered Users 2 Posts: 1,345 ✭✭✭Squall


    Should have been using the writeBytes() method not writeChar()

    Sorted now :)


Advertisement