You could just write the string length then the data to the file using the .length and index things on string.

file.write(mystr.length);
file.write(mystr); // should automatically write out all the bytes of the string

Reply via email to