Jump to content

Join 2 files


Recommended Posts

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
Link to comment
Share on other sites

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...