Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old October 24th, 2004, 05:47 AM
aweehan aweehan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 5 aweehan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Reading a text file into an array

Hi, I have a simple text file comprising 96 variables separated (by tab) into 8 lines and 12 columns.

I would like to read them into arrays of MTT(x,y) from x = 1 to 12 and y = 1 to 8.

While Not EOF(1)
For y = 1 To 8
For x = 1 To 12
Line Input #1, Eachline
i = Val(InStr(i, Eachline, Chr(9), 1)) - i
MTT(x, y) = Val(Left(Eachline, i))
Next
Next
Wend

Something is obviously wrong but I tried many different combis to no avail. The example above is just one of the futile attempts.

Please advise.
Attached Files
File Type: txt testread.txt (682 Bytes, 307 views)

Reply With Quote
  #2  
Old October 24th, 2004, 11:24 AM
aweehan aweehan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 5 aweehan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, solved using the split() function. First splitting each line with the tab-delimiter, then reading each value into the array using a loop.

Reply With Quote
  #3  
Old October 24th, 2004, 11:15 PM
Arjun Arjun is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 43 Arjun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 18 sec
Reputation Power: 4
Hi can you help

I am also having the same situation where i need to get some names from a textfile which are separated by tab ...
Actually i am not familiar with file handling
Can you tell me the code to open the file and the path settings please......

arjun

Reply With Quote
  #4  
Old October 24th, 2004, 11:37 PM
Arjun Arjun is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 43 Arjun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 18 sec
Reputation Power: 4
Can you

Hi,

Could you tell me the solution for the following :

I have a text file in c:\test.txt which has number of names separated by tab, I want to get those names in to an array....

Actually i am not familiar wiht file handling
can you please tell the codings from begining, like fiel open, path and read etc....

thanx

arjun

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Reading a text file into an array


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway