Sign in to follow this  
Followers 0
Xenobiologist

FileRead with NUL Chars

9 posts in this topic

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

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

anybody an idea how to write NULL chars into a textfile?

Autoit Help file

ASCII 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.html

Thanks!

Mega

Edited 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

Share this post


Link to post
Share on other sites

Ahh,

thanks! Sometimes the easy stuff is sooooo difficult. :mellow:

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

Share this post


Link to post
Share on other sites

Ahh, thanks! Sometimes the easy stuff is sooooo difficult. :mellow: Mega

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 !

Share this post


Link to post
Share on other sites

Once you learn it, it becomes easy. :mellow: 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

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