• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing byte data to a random access file

 
Thomas Paul Bigbee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a record to a random access file, I was trying this with(rowOfData.getBytes("UTF-8")) even though the correct number of spaces for each field was correctly input into the database, when I try to look at the record thur the UI the record comes out as gibberish, I then tried the writebytes() method which converts a string into a byte array, the same thing is happening, when I manually go into the database and cut a original record out and cut an input record out they match up exactly, does anybody know what I am doing wrong?

Thanks, in advance.
Tom


 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom,

I don't think there is anything wrong with your method of writing to file (except for the obvious lack of explicitly ensuring US-ASCII or UTF-8 is used). In which case it is more likely to be your method of creating the string that is problematic.

To test this, I wrote some code (that is deliberately bad code - it is better for you to find a good solution to your own problem than to copy my code). My program is When run, I can see the file looks reasonable:Regards, Andrew
[ July 14, 2005: Message edited by: Andrew Monkhouse ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic