Jump to content

How do i write a zero-character to file


Guest Alexey
 Share

Recommended Posts

Do you mean like this?

FileWrite($f, 0)
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Guest Alexey

to Insolence: Sorry for confusing title, i didn't mean a "0" character i mean a character with ASCII code equal to 0.

Okay, im still searching, here's what i have found so far:

AutoIt can't handle binary files (yet).

<{POST_SNAPBACK}>

You can write any ASCII character to a file using FileWrite($f, Chr($c)) where $c is from 1 to 255, but it doesn't do anything if $c = 0... Edited by Alexey
Link to comment
Share on other sites

this doesnt read or write binary files... but it can translate text into binary or binary into text, im not sure if thats what you need? :)

Func Text2Binary($text)
    $letters= StringSplit("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")
    $split= StringSplit("01100001,01100010,01100011,01100100,01100101,01100110,01100111,01101000,01101001,01101010,011010


11,01101100,01101101,01101110,01101111,01110000,01110001,01110010,01110011,01110100,01110101,0111011


0,01110111,01111000,01111001,01111010", ",")
    $out = $text
    For $i = 1 to $letters[0]
        $out= StringReplace($out, $letters[$i], $split[$i], 1)
    Next
    Return $out
EndFunc
$text2bin = Text2Binary("testing")
    MsgBox(0, "Text2Binary", $text2bin)
    
Func Binary2Text($binary)
    $letters= StringSplit("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")
    $split= StringSplit("01100001,01100010,01100011,01100100,01100101,01100110,01100111,01101000,01101001,01101010,011010


11,01101100,01101101,01101110,01101111,01110000,01110001,01110010,01110011,01110100,01110101,0111011


0,01110111,01111000,01111001,01111010", ",")
    $out = $binary
    For $i = 1 to $split[0]
        $out= StringReplace($out, $split[$i], $letters[$i], 1)
    Next
    Return $out
EndFunc
$bin2text = Binary2Text($text2bin)
MsgBox (0, "Binary2Text", $bin2text)
FootbaG
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...