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
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
I wanted to build my career in IT. Hats-off to the trainers at the training centre. They provide complete assistance and always ready to guide.
ReplyDelete<software testing training institutes in bangalore
software testing training in bangalore
best software testing training institutes in bangalore
software testing training course content
software testing training interview questions
software testing training & placement in bangalore
software testing training center in bangalore