Xenobiologist Posted July 29, 2008 Share Posted July 29, 2008 Hi, anybody got an idea how to quickly read a file with NUL chars? Or replace those bytes with nothing, so I can work with the file content? IK_KISG_VERBUND NOTE FinanzVerbund IK_KISG_PRODUKTE NOTE Verbundprodukte IK_KISG_VERBUNDKUNDEN NOTE Verbundkunden That is what I want to get back from the read function. Thanks! Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
weaponx Posted July 29, 2008 Share Posted July 29, 2008 FileRead handles the NULL characters correctly, MsgBox and ConsoleWrite do not. Just perform a replacement. $file = FileRead("GLOIK.txt") $file = StringReplace($file,Chr(0), "") ConsoleWrite($file & @CRLF) Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 29, 2008 Author Share Posted July 29, 2008 Hi, thanks. You are right. There was a mistake, cause I also used StringRegReplace in lieu of StringReplace which leads to empty files if the first char is a NUL char. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 30, 2008 Author Share Posted July 30, 2008 (edited) Problem solved, but one question left. When do you really need the raw mode, while FileRead reads the file correctly even with NUL chars. Mega Edited July 30, 2008 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted November 14, 2008 Author Share Posted November 14, 2008 (edited) Hi,anybody an idea how to write NULL chars into a textfile?Autoit Help fileASCII Characters Char... Dec Hex Description NUL 0 00 Null character This shows how it should look like when the FileWrite is done. (Screenshot from Scite)http://www.file-upload.net/view-1253240/inhalt.JPG.htmlThanks!Mega Edited November 14, 2008 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
jvanegmond Posted November 14, 2008 Share Posted November 14, 2008 Use the Binary() function on your string. Like so: $sOutput = Binary( Chr(0) & "lulz" ) $hFile = FileOpen("mytest.txt", 2) FileWrite($hFile, $sOutput) FileClose($hFile) github.com/jvanegmond Link to comment Share on other sites More sharing options...
Xenobiologist Posted November 14, 2008 Author Share Posted November 14, 2008 Ahh, thanks! Sometimes the easy stuff is sooooo difficult. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
jvanegmond Posted November 14, 2008 Share Posted November 14, 2008 Ahh, thanks! Sometimes the easy stuff is sooooo difficult. MegaOnce you learn it, it becomes easy. You should really check out all the new binary functions, I know you've been using AutoIt for a long time. But the new Binary functions are excellent ! github.com/jvanegmond Link to comment Share on other sites More sharing options...
Xenobiologist Posted November 14, 2008 Author Share Posted November 14, 2008 Once you learn it, it becomes easy. You should really check out all the new binary functions, I know you've been using AutoIt for a long time. But the new Binary functions are excellent !Yeah thanks. My fault was not the not-use of Binary functions. For whatever reason I thought I have to handle it with the FileOpen parameter 4 or 16. That is why I stagnated at that point. Anyhow, thanks again.Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
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