Jump to content

How to append the content from one file to a other


Recommended Posts

Use a a couple of the functions in the helpfile is probably the easiest way to do this. Just use the example below. It is tested and works. Just change the filenames to suit your needs.

Dim $fileR, $fileA;$file(R)ead and $file(A)ppend
Dim $fileRCon;$file(R)ead(Con)tents

$fileR = FileOpen("output.txt", 0);Open read only mode.
If $fileR = -1 Then
    MsgBox(0, "Error", "Unable to open $fileR")
    Exit
EndIf

$fileRCon = FileRead($fileR, FileGetSize("output.txt"));Read entire file into variable

FileClose($fileR);Close file

$fileA = FileOpen("swfout.txt", 1);Open in append to end mode.
If $fileA = -1 Then
    MsgBox(0, "Error", "Unable to open $fileA")
    Exit
EndIf

FileWrite($fileA, $fileRCon)

FileClose($fileA)

Also just for next time. Try to make an attempt. I am bored otherwise I would have just told you to look in the help file at the above functions.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Or ..

RunWait( @COMSPEC & " /c COPY c:\a.txt + c:\b.txt c:\output.txt", "", @SW_HIDE )

HTH 

:)

<{POST_SNAPBACK}>

Ah but who wants to do that when you can recreate the wheel? :evil:

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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...