0

well, i am having problems with the code i made, i want to inject hexadecimal in a certain file, but when compiling comes an error message saying that some symbols are missing

String str = "rw";
String str2 = "test.so";  

try {
 raf = new RandomAccessFile(str2, str);
 write(0x1234, "0100A0E3");
} catch (FileNotFoundException e) {
 e.printStackTrace();
}


public void write(int i, String str) {
 try {
  raf.seek((long) i);
  raf.write(Hex2b(str));
 } catch (IOException e) {
  e.printStackTrace();
 }

could anyone tell which symbols are missing? I'm new to programming

  • 1
    1) What is `Hex2b`? --- 2) The first block of code seems to be outside a method. --- 3) Is `raf` a field? --- 4) You never close `raf`. --- Please **edit** the question and give all the relevant code. – Andreas May 23 '21 at 02:18

1 Answers1

0

Hex2b isn't a thing. I don't know where you got that from. Info on how to convert a string such as "0100A0E3" into bytes so that you can pass it as argument to raf.write can be found at this SO answer.

rzwitserloot
  • 85,357
  • 5
  • 51
  • 72