Solved

3 lines in one

Posted on 2001-06-27
5
126 Views
Last Modified: 2010-05-02
i have a text file
c:\Bob\log.txt
it has info on 3 lines that i need in a new text file,with the 3 lines combined, then loop thru the whole text file and combine
 
bob
fred
stan
mel
ralph
pete

bob fred stan
mel ralph pete
0
Comment
Question by:underground712
  • 3
5 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 6230727
Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do
  Input Line #1,strLine1
  Input Line #1,strLine2
  Input Line #1,strLine3
  Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop Until Eof(1)
Close #1
Close #2
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6230734
Sorry that should be:

Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do
 Line Input #1,strLine1
 Line Input #1,strLine2
 Line Input #1,strLine3
 Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop Until Eof(1)
Close #1
Close #2
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6230735
Sorry that should be:

Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do
 Line Input #1,strLine1
 Line Input #1,strLine2
 Line Input #1,strLine3
 Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop Until Eof(1)
Close #1
Close #2
0
 
LVL 18

Expert Comment

by:deighton
ID: 6230771
Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do Until Eof(1)
Line Input #1,strLine1
Line Input #1,strLine2
Line Input #1,strLine3
Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop
Close #1
Close #2
0
 
LVL 1

Expert Comment

by:eosu
ID: 6231174
Sorry - not clear on the question - you want every 3 lines merged into 1? or just the first 3, in which case what do you want done with the remaining lines?
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now