Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With Input File

Status
Not open for further replies.

codenovice

IS-IT--Management
Dec 4, 2001
11
US
I have a file which is delimited by a space like
1 2 3 4 5 6
7 8 9 10 11
.
.
Now I need to pick elements say 1, 5, 12, 35 etc.. and I am using array with reard to help from Jon. However, I could not sove it.
I need help in using the values and one more thaing it gives me Input error 62 " Beyond the Input File"

Kindly Help me

Codenovice
 
What help from Jon? We need more info such as what kind of file etc. If you can post what Jon suggested that would be helpful.
 
I need to open a .txt file that has values both +ve and Negative and are doubles.
Below is the code that Jon has provided me.

Thanks


************************************************************
How about reading all the values into an array ?

Dim intCount as integer
Dim dblMyVar as double
Dim dblArr(35) as double
Dim strFile as string
...
intCount = 0
Open strFile for Input as #1
while (not eof(1))
Input #1, dblMyVar
dblArr(intCount) = dblMyVar
intCount = intCount + 1
wend

This way you load all your values in an array then you can pick and choose which ones you want

Jon
 
I think this method requires that your sequential data be comma delimited. You could use the Input function:
Input(number, [#]filenumber) where number is the number of characters you want to return. Return a character at a time until reach a nonspace, that will be the beginning of a number, then return a character at a time until reach a space and that will be the end of that number. Concatenate all those characters together and convert them to double and add them to your array. Then start over fetching a character at a time until you reach eof.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top