Jump to content
Sign in to follow this  
Phil Viton

read binary file?

Recommended Posts

Phil Viton

Is it possible to read a binary file ? I can see that FileRead is for text files, but _FileReadtoArray seems to have no such limitation. I used _FileReadToAarray to open a pdf file, and then _FileWriteFromArray to write the entire thing back to disk under another name; but when I looked at the file, only the first 7 (or so) records of the file got written: the sizes were: original file 97K ; copy: 129 bytes.

Share this post


Link to post
Share on other sites
monoceres

FileRead is also for binary files, but you need to open the file first with FileOpen, example:

$in=FileOpen("input.exe",16) ; 16+0=Read binary
$out=FileOpen("output.exe",17) ; 1+16=Write binary
$data=FileRead($in)
FileWrite($out,$data)

:(

Edit: Kip the ninja :)

Edited by monoceres

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.