Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

Search: 

  Tutorial: ASP File Manipulation Open and Read a File with ASP Tutorial

This is some sample code for reading a file with ASP.

Tutorial Details:

ASP File Manipulation

In this example we open a file which is in this case called sampletext.txt . This file contains several lines which we wish to display , so we loop the lines of text one at a time and display them until there are none left to display.

<%
Const ForReading = 1
' our variables
Dim objFSO , objTextStream , strText , strFileName
'Path to our text file
strFileName = Server.MapPath("sampletext.txt")
'create an instance of the FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'open our text file
Set objTextStream = objFSO.OpenTextFile(strFileName , ForReading , False)
If not objTextStream.AtEndOfStream Then
Do While not objTextStream.AtEndOfStream
'read in our text one line at a time and display it
strText = objTextStream.ReadLine
Response.Write strText & "
"
Loop
End If
objTextStream.Close
'good practice to setobject variables to nothing
Set objFSO = Nothing
Set objTextStream = Nothing
%>


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
ASP File Manipulation Open and Read a File with ASP Tutorial

View Tutorial:
ASP File Manipulation Open and Read a File with ASP Tutorial

Related Tutorials:

Displaying 1 - 50 of about 3586 Related Tutorials.

PHP File Manipulation Writing to a File Tutorial
how to open a file and read the The following examples will let you know about... File Manipulation in PHP File Manipulation in PHP...;  In this tutorial we will learn how to write data to a flat file
 
Java Read File Line by Line - Java Tutorial
Java Read File Line By Line,How to Read File Line By Line in Java Java Read File Line by Line - Java Tutorial... program to read file line by line. We will use the DataInputStream class to Read
 
VB and ASP programmers
VB and ASP programmers VB and ASP programmers...;  Position Vacant: VB and ASP programmers  Job Description  Visual basic programmer with ASP knowledge to develop
 
C file read example
C file read example C file read example...;  This section demonstrates you to read a line from the file. You... to read. The library function gets() get the entered file from the console
 
Java read file line by line - Java Tutorial
; }--> Java read file line by line - Java Tutorial   ... read file,read from file java,read text file,read file java,read text file java,java read file,java read file line by line
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.