Sign in to follow this  
Followers 0
blindwig

Cannot write #0 to a file

2 posts in this topic

OK, I found a way to read a #0 from a file:

Func FileReadByte($hFile)
    Local $ch = FileRead($hFile, 1)
    If @Error Then
        SetError(1)
        Return -1
    EndIf
    Return Asc($ch)
EndFunc

Basically, if the FileRead() function returns '' and @error is not set, you can assume that the byte is a #0. However, I can't seem to write a #0, because FileWrite() only writes strings (if you pass it a number, it converts it to a string before writing it).

Is there anyway to write a #0 to a file?

I'm writing a set of functions for base64 encoding/decoding, which should solve the problem with binary files and binary data transmission, but I can't write the file back out at the end, because any #0 are left out of the final file.

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