Jump to content
Sign in to follow this  
torels

how to write Null char in file... Chr(0) seems not to work :(

Recommended Posts

torels

Hello

Does anybody know how to write a null char [Chr(0)] to a file ?

I tried using Chr(0) but it desn't write anything... or it does but writes "" instead of (null) :)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
JRowe
torels

Because Null = "". 'Null' is nothing, it's End of line.

OK... but if I write a script in vbs writing Chr(0) on a file and open it in scite I get the 'nul' rectangle and if I write it in autoit I get simply nothing... why ?


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
torels

Why would you want to write nothing to a file? Just curious.

I want to write the zip header on a file... and it includes 18 'null's not 18 ""s & chr(5) & chr(6) & P & K


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
Kip

I want to write the zip header on a file... and it includes 18 'null's not 18 ""s & chr(5) & chr(6) & P & K

Then just try that.

Share this post


Link to post
Share on other sites
torels

It's What I did... But it doesn't work --> http://www.autoitscript.com/forum/index.ph...mp;#entry534471

I'ts only working on VBS

I think it's just the way autoit treats nul characters


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
monoceres

You need to open the file in binary mode to write the null char:

$handle=FileOpen("hello.au3",17)
FileWrite($handle,Chr(0))

:)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
torels

YES! :)

thanks alot monoceres :)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
James

You need to open the file in binary mode to write the null char:

$handle=FileOpen("hello.au3",17)
FileWrite($handle,Chr(0))

:)

Then you could probably open the file in normal mode allowing you to write other data, but I doubt it will work or is nessacary.

Share this post


Link to post
Share on other sites
picaxe

adding text in binary mode works

$hFile = FileOpen("test.tmp", 18)
FileWrite($hFile, "the quick brown fox " & Chr(0))

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  

×