Jump to content
  • Advertisement
Sign in to follow this  
V-man

Python, writing to file

This topic is 3632 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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"

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!