Jump to content

Writing Null To A File


Recommended Posts

I've been writing some code and need to write ASCII NULL (Hex 0x00) to a file.

Now as I see it the FileWrite($file, Chr(0)) should do this but when executed actually writes nothing to the file. FileWrite($file, Chr(1)) and does work properly writing hex 01 to the file. I have also tried FileWrite($file, 0x00) which ends up writing a decimal 0 (Hex 0x30) to the file and not the intended NULL.

Is this a bug or is there another way I'm not aware of?

Thanks

smiley

Link to comment
Share on other sites

Thank you flyingboz, I did a search before I wrote this but did not see anything on Nulls, obviously there was.

Thank you very much ezzetabi, that is a perfect thread of a work around. In my case it would be iffy to use that since Im writing random hex values to a file of which could be nulls. I guess if Im writing a null to a file I could write lets say a unique sequence of characters (more than a few to be sure) instead which I could afterwards swap out for a null. Reading nulls back from a file seems possible with Autoit at least one character at a time which is fine so Ill give it a try. A backup option is to just write it in C which is my favourite language but I do love Autoit to quickly get an idea off the ground and automate testing programs.

smiley :ph34r:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...