• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RandomAccessFile.write() -> curious

 
Mike Semlitsch
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

with the following code I want to write 10 Bytes with hex-value 0x58 (ISO-8859: "X") to the RandomAccessFile.



But only 9 Bytes with hex-value 0x58 are written. The tenth byte has the value 0x00.

Why does this happen??

Thanks
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

it is very late for me (2h30am).. maybe I'm overlooking... but isn't that your for loop is doing only 9 loop... so you only copy your value 9 times..

There should be no "-1":


Regards,
Alex
 
Mike Semlitsch
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,

thank you. I am ashamed.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic