topten

Read as binary, but write as...?

5 posts in this topic

I need to read a file (no matter exe or txt) as binary. Then I write out file as binary. How can I decode back the txt file as a normal text?

 

$in = FileOpen (@Desktopdir & "\myfile.txt", 16)
$dbdata = FileRead ($in)
FileWrite (@Desktopdir & "\myfile2.txt", $dbdata)

 

Share this post


Link to post
Share on other sites



Something about @DesktopDir works for me using other directories.

Share this post


Link to post
Share on other sites

BinaryToString

Share this post


Link to post
Share on other sites

I think I should specify the situation:

I read text file  or binary file as binary (file1) , save it to disk with other name (file2). After that all the info from text file or exe file are stored on disk as binary. Later I read (file2) and I want to save it to say file3- as it was originally created- text as text exe as exe

$path = @Desktopdir & "\myfile2.txt"
$in2 = FileOpen ($path, $FO_READ + $FO_OVERWRITE+ $FO_BINARY)

This way didnt work

binarytostring also didnt help

FileWrite ($in2, BinaryToString($dbdata))

 

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