Sign in to follow this  
Followers 0
czmaster

Join 2 files

3 posts in this topic

#1 ·  Posted (edited)

Hello,

I want to join 2 binary files using autoit.

Without help I would do something like that (with fileopen ...)

$a=fileread($file1)
$b=fileread($file2)
filewrite($file3,$a&$b)

What do think about that ?

Have you a best idea ?

Thanks

Edited by czmaster

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this function:

Func JoinFile($sFile1, $sFile2, $sFileJoined) ;coded by UEZ 2012
    If Not FileExists($sFile1) Then Return SetError(1, 0, 0)
    If Not FileExists($sFile2) Then Return SetError(2, 0, 0)
    If Not IsString($sFileJoined) Or $sFileJoined = "" Then Return SetError(3, 0, 0)
    $hFile = FileOpen($sFileJoined, 2 + 16)
    If $hFile = -1 Then Return SetError(4, 0, 0)
    FileWrite($hFile, Binary(FileRead($sFile1) & FileRead($sFile2)))
    FileClose($hFile)
    Return 1
EndFunc

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

might want to add a @crlf between files so the last line isn't concatenated with the first line of the second file:

FileWrite($hFile, Binary(FileRead($sFile1) & @crlf & FileRead($sFile2)))


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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