Sign in to follow this  
Followers 0
yookee

How to write Chr(0) into a file?

5 posts in this topic

FileWrite($file, Chr(0)) will write nothing.

For example

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

52 49 46 46 44 7C 09 00 57 41 56 45 66 6D 74 20 RIFFD|..WAVEfmt

How can I write 00 to file directly?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

If you want to append a zero to the end, then ...

$F = FileOpen("testl.bin", 17)
If $F = -1 Then MsgBox (0,"Error","1")

$ret2 = FileWrite ($F, Chr(0))
If $ret2 = 0 Then MsgBox (0,"Error","2")
Edited by Inverted

Share this post


Link to post
Share on other sites

If you want to append a zero to the end, then ...

$F = FileOpen("testl.bin", 17)
If $F = -1 Then MsgBox (0,"Error","1")

$ret2 = FileWrite ($F, Chr(0))
If $ret2 = 0 Then MsgBox (0,"Error","2")
Mm, mode 16 is key point.

THX.

Share this post


Link to post
Share on other sites

Yep, essentially it's 16+1

Share this post


Link to post
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
Sign in to follow this  
Followers 0