Sign in to follow this  
Followers 0
Charly

FileWrite with binary files.

12 posts in this topic

Hi all,

I'm trying to create a binary file and somo of the data I have to write is NULL, (0x00h).

I mean, that I need to write Hexadecimal numbers and when I have to write a value 0 it isn't written.

The line I use is:

FileWrite($file1, Hex(0))

Does anyone have written a Binary file using Autoit?.

Thanks in advance,

Charly

(Madrid - Spain)

Share this post


Link to post
Share on other sites



Maybe try

FileWrite($file1, Chr(0))

instead?

#)

Thank you nfwu but it's exactly the same.

When you try to write any tipe of data with the value 0, (Hex(0), Dec(0), Chr(0)) it doesn't run.

Share this post


Link to post
Share on other sites

in the beta there is BinaryString( expression )

Returns a binarystring

might be something to look at


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

So Chr(0) won't work on it's own.

But if I do "a"&Chr(0)&"b", the Chr(0) DOES appear between the "a" and the "b"

maybe that should help?

(""&CHR(0)&"" DOES NOT work.)

#)

Share this post


Link to post
Share on other sites

So Chr(0) won't work on it's own.

But if I do "a"&Chr(0)&"b", the Chr(0) DOES appear between the "a" and the "b"

maybe that should help?

(""&CHR(0)&"" DOES NOT work.)

#)

No, I tried it and writes a and b but not the NULL char.

It writes byte by byte and when it finds a 0 value it ignores it.

Share this post


Link to post
Share on other sites

Very interesting.... Must be a bug somewhere, the help file (indirectly) said "a"&Chr(0)&"b" works...

???

#)

Might want to make sure your both using the same version before calling it a bug, far as I know that is in the beta help, not the release help


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
EchoEchoEchoEcho :o

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Very interesting.... Must be a bug somewhere, the help file (indirectly) said "a"&Chr(0)&"b" works...

???

#)

Thank you for your interest any way.

I'll report it as a bug and I'll try the new Binary options in the beta version.

See you around.

Share this post


Link to post
Share on other sites

Might want to make sure your both using the same version before calling it a bug, far as I know that is in the beta help, not the release help

Thanks gafrost,

I've tried all the conbinations with the FileWrite command and it's thought only for text files.

I'll try the binary function you told me and I'll tell you something about it.

Thanx

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