let's say i have a .dat file and .hdr file .... i have to compare both of them .... how can i open both of them at the same time and then compare them ? do you think is it prossible? pls help me?
Edit/Delete Message

The file Access component consists of two objects that give script access to textfiles. The textstream object lets your script open,read from and write to text files. Caution: These objects cannot be used with binary files!

First create a filesystemobject and bind it to a Binder by the set command.

Set fs = CreateObject("Scripting.FileSystemObject")

now by using the binder fs you can open any number of files with seperate handlers. eg.

Set Mystream1 = fs.OpenTextFile(filename1, iomode,create,format)
Set MyStream2 = fs.OpenTextFile(filename2,iomode,create,format)
...
etc.

Mystraem1,Mystream2 are two seperate handlers for the specific files, filename1 and filename2.

The filname1,filename2 etc argument is the only required one. Of the remaining optionals, the iomode can be one of the following constands:

ForReading --- read only
For Appending ---- file opend for appending data

The create is a boolean value which notify its succees or failier.

The format is again True or False. True means UNICODE, False
ASCII

Now you can read write your files by the filehandlers. eg.

Mystream1.Read(characters)
Mystream1.ReadAll
Mystream1.ReadLine
Mystream2.Wrtite(string)
Mystream2.WriteLine(string)

where
characters is the number of characters
All means, the entire contents of the file
Line meane one line at a time.

Write(string) writes a string into the file without a newline characher, whereas WriteLine writes the string and append it with a newline character.

Happy Programming.

regards
AV Manoharan

This article has been dead for over six months. Start a new discussion instead.