Help With Tab Delimited Text File

I am importing a tab delimited text file, and have a few problems.The software I'm writing in is VB6. The text file being imported, has text on the first 50 lines. The rest of the text file, has numeric values in a tab delimited format. The text on the first 50 lines, needs to be deleted, and the rest of the numeric values, needs to be written to a temporary file named "temp.dat". A sample of the first 50 lines of text data on the imported file is as follows:
~VERSION INFORMATION
VERS . 2 : CWLS Log ASCII Standard Version
WRAP . NO : One Line per Depth Step
DLM . SPACE : Delimiter between data columns - one or more spaces

The numeric values in the same file, starting at line 51, is as follows:
9010 4.083 34.38 6876 0 0 0 0 0 34.38 0.00 6.4 0.0 0 0.0000 0.00 0.00 0.0 0.00 04:27:55 2009/12/22
If I manually delete the first 50 lines of data, this code works. I would like to programmatically delete the first 50 lines, and then copy the rest of the values into the "temp.dat" file. The code I have follows:
[CODE]
Private Sub Command1_Click()
Dim FileNum As Long
Dim TotalFile As String
Dim Records() As String
Dim X As Long
Dim Columns() As String
'delete header-first 50 lines
'this is where I am stuck
' Let VB generate the file channel number
FileNum = FreeFile
' Reads the whole file into memory all at once
Open "C:DB_CUEiball las.las" For Binary As #FileNum 'edited file
TotalFile = Space(LOF(FileNum))
Get #FileNum, , TotalFile
Close #FileNum

Open "c:DB_CUETemp.dat" For Output As #2
Records = Split(TotalFile, vbCrLf)
For X = 0 To UBound(Records)
Columns = Split(Records(X), vbTab)
Print #2, Columns(0) & vbTab & Columns(1) & vbTab & Columns(2) & vbTab & Columns(3) _
& vbTab & Columns(4) & vbTab & Columns(5) & vbTab & Columns(6) & vbTab & Columns(7) _
& vbTab & Columns(8) & vbTab & Columns(9) & vbTab & Columns(10) & vbTab & Columns(11) _
& vbTab & Columns(12) & vbTab & Columns(13) & vbTab & Columns(14) & vbTab & Columns(15) _
& vbTab & Columns(16) & vbTab & Columns(17) & vbTab & Columns(18) & vbTab & Columns(19)

Next X
Close #2
END SUB
[/CODE]
Does anyone have any professional advice on how to approach this? Much help is greatly appreciated. Thanks
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories