|
Technical Interview Questions
Visual Basic Interview Question
.NET Web Interview Questions
.NET
Interview Questions
C#
Interview Questions
.........More
Source Codes
Asp .NET Source Codes
Asp VB Script Source Codes
.........More
Soft Skills
Communication Skills
Leadership Skills
.........More
|
|
Asp/VB Script Source Codes
Read a File
<%
Set fs = CreateObject("Scripting.FileSystemObject")
filename = server.mappath("/somedirectory/readfile.txt")
Set thisfile= fs.OpenTextFile(filename,1,False)
Do until thisfile.AtEndOfStream
thisline = thisfile.readline
If thisline "" then
Response.write thisline
End If
Loop
thisfile.close
set thisfile = Nothing
set fs = Nothing
%>
Read ALL
<%
Set fs = CreateObject("Scripting.FileSystemObject")
filename = server.mappath("/files/data.txt")
Set thisfile= fs.OpenTextFile(filename,1,False)
S = thisfile.ReadAll
thisfile.close
Response.Write S
set thisfile = Nothing
set fs = Nothing
%>
Notice the numbers 1,2 and 8 in the above examples. Here is what they represent
1: Opens file for reading. Cannot write to this file
2: Opens file for writing. This file can't be read. Writing anything to this
file would overwrite the previous contents.
8: Opens the file for appending. The previous contents is not overwritten.
Notice the "True" and "False" parameters in examples above
True: The file will be created if it doesn't exist
False: A new will not be created if it doesn't already exist.
<<<----- Return to
Asp/VB Script Source
Code Questions Page.
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Microsoft .Net Interview Questions
for more Microsoft
.Net Interview Questions with Answers.
Check
.Net Database Interview
Questions for more .Net Database Interview Questions with answers
Check
Job Interview Questions
for more Interview Questions with Answers
|