We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 18,042 times

Related Categories

Merge Two Files

Kimmy

A small example of how to merge 2 files together.

Example

x=Join("C:\Test1.txt", "C:\Test2.txt")
Msgbox "Joined Successfully. NewSize of test2.txt is"+str$(x)

Function Join(strFile1 As String, strFile2 As String) As Long
    Dim b() As Byte
    Dim nFileNum As Integer
    Dim lFileLen As Long

    nFileNum = FreeFile
    Open strFile1 For Binary Access Read As nFileNum
        b() = InputB(LOF(nFileNum), nFileNum)
    Close nFileNum

    nFileNum = FreeFile
    lFileLen = FileLen(strFile2)
    Open strFile2 For Binary Access Write As nFileNum
        Put nFileNum, (lFileLen+1), b()
    Close nFileNum
   
    Join = lFileLen
End Function

Till the Roof comes off Till the Lights go out Till my Legs give out Can't shut my mouth I will not fall, my Wisdoms all.

Comments

  • Re: [1803] Merge Two Files

    Posted by Vbnex on 06 Jan 2007

    hello


    i  do this and it work


    Now if somebody can help because I realy want to retrieve my file "Ani1.swf,data.xml" by using 1.chmikir "the concatfile " this is my code


    <...

  • Posted by James Crowley on 28 Oct 2001

    Thanks for pointing that out. The article has been corrected.

  • Error in this code

    Posted by davwebuk on 28 Oct 2001

    I have noticed an error in this code where is says:

    Put nFileNum, lFileLen, b()

    it should read

    Put nFileNum, (lFileLen + 1), b()

    if you use the original code then you will ...