Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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