Sign in to follow this  
Followers 0
n4th4nr1ch

Reading a file problem

5 posts in this topic

Hi,

Trying to read a file. It's a binary config file. When I use DOS's 'type' command I see characters.

Really what I want to do is something like the command 'strings' in UNIX: show the strings in a binary. However I will settle for just the whole output of the file.

The problem is that due to the binary status of the file (I'm guessing), I can only seem to get the first character of the file.

I've tried several things, for example this:

$test = FileRead('c:\test.file')
msgbox(0,'title', $test)

That just shows me the first character of the file. I've tried messing around with BinarytoString as well.

Help! =]

Share this post


Link to post
Share on other sites



$in=FileOpen("C:\ifOutput.txt",16)
$out=FileOpen("C:\ifOutput2.txt",2)
$data=FileRead($in)
FileWrite($out,$data)
MsgBox(0,"","binary"&IsBinary($data))
MsgBox(0,"",binarytostring($data))
msgbox(0,"","here")

If I run this code, only one message box ever opens. I think there is a bug in the binarytostring function (?)

Share this post


Link to post
Share on other sites

I'm trying to get the 'text' from a binary, without all the 'other' characters which seem to screw up autoit.

The way I arrived at that conclusion is that if I try to convert to string, the script just hangs forever and I need to force kill it.

Share this post


Link to post
Share on other sites

I'm trying to get the 'text' from a binary, without all the 'other' characters which seem to screw up autoit.

The way I arrived at that conclusion is that if I try to convert to string, the script just hangs forever and I need to force kill it.

You are reading the whole file in one time into a binary field and then you convert the whole thing back to a string.

Is that what you want to do or maybe something else?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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