Search Tools Links Login

Read/Write Files with VBScript


Read and write textfiles with VBScript.

Original Author: Wraithnix

Inputs

In the source.

Assumptions

In the source.

Returns

In the source.

Side Effects

In the source.

API Declarations

None.

Code

rem This function will write a file.
rem Usage: WriteStuff ,
Function WriteStuff(fileout,textout)
Dim filesys,filetxt
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile(fileout,True)
filetxt.WriteLine(textout)
filetxt.Close
End Function
rem This function will read the contents of a textfile.
rem Usage: buffer = ReadStuff()
Function ReadStuff(fileout)
Dim filesys,filetxt
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile(fileout)
ReadStuff = filetxt.ReadAll
filetxt.Close
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 82 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.