Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 11-28-2006, 09:17 PM Reading from a file
VTWebProperties's Avatar
Skilled Talker

Latest Blog Post:
WEB 2.0 Apps For iPhone
Posts: 64
Name: Ed
Location: Vermont
Trades: 0
Can someone give quick code sample on reading a tab-delimited file in ASP?

The format would be

data[tab]data[tab]data[tab]data[newline]
data[tab]....
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VTWebProperties is offline
Reply With Quote
View Public Profile Visit VTWebProperties's homepage!
 
 
Register now for full access!
Old 11-30-2006, 04:39 PM Re: Reading from a file
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Trades: 0
What do you need to do with the data that's tab delimited?

It's 2 parts. The examples shown below are completely separate and you will need to integrate them to get the desired result

1st is reading the file (http://www.w3schools.com/asp/asp_ref_textstream.asp)

<%
Set fs=Server.CreateObject("Scripting.FileSystemObject ")

Set f=fs.OpenTextFile(Server.MapPath("testread.txt"), 1)
Response.Write(f.ReadAll)
f.Close

Set f=Nothing
Set fs=Nothing
%>

2nd part is splitting the delimited text by putting it into an array:
<%
Dim strTabs
strTabs = "this is a test of tabs" ' text you want to split

arrayTabs = Split(strTabs, " ") 'split when there are 5 spaces could be replaced with comma to separate by comma

For i = 0 to 6
Response.Write(arrTabs & "<br>") ' output of split text
Next
%>

will appear as:
this
is
a
test
of
tabs
__________________

Please login or register to view this content. Registration is FREE

"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Reply     « Reply to Reading from a file
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45496 seconds with 12 queries