0

I'm working with editing GCT code files. I've already been able to open them fine. They are just files with hex code. I've been able to open them the following way:

byteArray = getBytesFromFile(file);
String inputString = byteArrayToString(byteArray);

So now, after editing the string I made, I want to be able to save it back to a GCT file. From searching online and looking at stuff, the code I was trying was...

String toProcess = "00D0C0DE00D0C0DE" + inputCodes + "F000000000000000";
byteArray = toProcess.getBytes();
fileOutput.write(byteArray,offset,byteArray.length);

inputCodes is just a bunch of other hex values similar to the ones being added with it from elsewhere in the program. byteArray is an attribute of the class, a simple array of bytes. offset is an int that = 0.

This makes a GCT file, but instead of writing the String as the hex values, it writes the hex values of the string. How can I output a file with the string being the hex values?

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by ChiboSempai
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.