vb Read and Write files

Sub ReadTextFile()
	Dim FS,F,T,strData

	Set FS = Server.CreateObject("Scripting.FileSystemObject")
	Set T = FS.OpenTextFile(Server.MapPath("notes.txt"),1,false)
	
	strData = T.ReadAll
	T.Close

	Response.Write(strData)
	
	Set FS = Nothing
	Set T = Nothing
End Sub

Sub SaveData(strFileName,strData)
	Dim FS,F
	
	Set FS = Server.CreateObject("Scripting.FileSystemObject")
	Set F = FS.CreateTextFile(Server.MapPath(strFileName),true)

	F.Write(strData)
	F.Close

	Set F = Nothing
	Set FS = Nothing
End Sub
Reads data from a text file and writes data to it.

Updated: Saturday 9th October 2010, 11:56pm

There are 0 comments

Leave a comment of your own

Comments are currently closed.