Python, writing to file
In order to write to my file
mystring="mystring";
file.write(mystring);
but it doesn't write the NULL char I believe. I need to write the NULL char as well due to the file format requirement.
Do I have to do another file.write command to just write a 8 bit 0 value? What would the code look like?
Quote:Original post by V-man
In order to write to my file
mystring="mystring";
file.write(mystring);
but it doesn't write the NULL char I believe. I need to write the NULL char as well due to the file format requirement.
Do I have to do another file.write command to just write a 8 bit 0 value? What would the code look like?
You should be able to just add the NULL char at the end using the following
statement: mystring = "mystring\0"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement