My Blog List

Thursday, October 24, 2013

Control the text file pointer

We could have faced a problem like getting back the reading location of a opened text file to re-read or re-search the file from beginning ...
We don't have a right approach to do this in VBScript using FileSystemObject without close and reopening the file. But we could do using STREAM object without reopen ...

Dim myFileStream
Set myFileStream = CreateObject("ADODB.Stream")
myFileStream.CharSet = "UTF-8"
myFileStream.LineSeparator = 13
myFileStream.Open
myFileStream.LoadFromFile("C:\MyFile.txt")

msgbox myFileStream.ReadText(-2) 'Returns first line

myFileStream.Position = 0
msgbox myFileStream.ReadText(-2) 'returns first line again as expected
myFileStream.Close

posted from Bloggeroid

7 comments:

  1. I have read your blog and i got a very useful and knowledgeable information from your blog.its really a very nice article. I did Loadrunner Course in Chennai. This is really useful for me. Suppose if anyone interested to learn Manual Testing Course in Chennai reach FITA academy located at Chennai Velachery.

    ReplyDelete
  2. I gathered a lot of information through this article. Program is easy to undestandable and explaining the logic easily.Thanks! CCNA training in chennai | CCNA training chennai | CCNA course in chennai | CCNA course chennai

    ReplyDelete
  3. Your information about Selenium scripts is really interesting. Also I want to know the latest new techniques which are implemented in selenium. Can you please update it in your website? Selenium testing training in Chennai

    ReplyDelete
  4. Thanks for sharing informative article on mobile testing. It helped me to understand the future of mobile application development and need of mobile application testing training. Think of joining mobile application testing training in Chennai from reputed IT placement or training academy.

    ReplyDelete
  5. Nice article about Test Automation Ecstasy.People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get selenium training institute in chennai.

    Java related trainings are selenium training in chennai | Android training in chennai | Java training in chennai

    Management training Primavera training in chennai

    ReplyDelete