|
-
Mar 23rd, 2008, 01:21 AM
#1
Thread Starter
Frenzied Member
Input from files column number
I would like to do like this, If the files have four column from files, then it read the the line header from column 2 untill four.. How to do that? I have files some time have 3 column and four column. By default I want the program read the X,Y,Z value only.
Code:
Open txtDir For Input As #12
n = 0
'Read the file header first
Line Input #12, XYZ
' Print #13, "X", "Y", "Z"
While Not EOF(12)
Input #12, Point.x_out, Point.y_out, Point.z_out
n = n + 1 'Record counter
Wend
-
Mar 23rd, 2008, 01:39 AM
#2
Re: Input from files column number
I'd think you could use Line Input in the loop, rather than Input, and then Split
Code:
Dim strData() As String
'
'
Line Input #12, strInput
strData = Split(strInput, ",") ' assumes comma delimited data
Point.x_out = Val(strData(0)
Point.y_out = Val(strData(1)
Point.z_out = Val(strData(2)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|