Results 1 to 3 of 3

Thread: Adding 2 Arrays!

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Question Adding 2 Arrays!

    I am reading the contents of 2 different text files in 2 different array variables. How do I combine the contents of the 2 array variables in one single array variable?

    Or better still, how do I combine the contents of 2 text files & then load them in an array variable? Please note that I wouldn't prefer creating a third text file & populating the contents of the first 2 text files in the third text file.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Adding 2 Arrays!

    Are the two files in the same format? Then (pseudocode):

    initialize the array pointer
    Open the first file
    Call the read-into-array routine with the first file number
    Close the first file
    Open the second file
    Call the read-into-array routine with the second file number
    Close the second file

    Read-into-array routine
    while not eof(file)
    read a line
    put it into the array
    increment the array counter
    wend

  3. #3
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: Adding 2 Arrays!

    Combining two arrays:

    Array3 = Split(Join(Array1,Delimiter) & Delimiter & Join(Array2, Delimiter),Delimiter)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width