blindwig Posted July 7, 2005 Posted July 7, 2005 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. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
Lazycat Posted July 8, 2005 Posted July 8, 2005 DllStruct + API Read/Write. Start with this thread. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now