Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
UFT + UFTPro 20th September 2017 7.30 AM - 9.00 AM IST 25Days Classroom + Online Hitech City
Selenium+Appium 4th October 2017 4.30 PM - 6.00 PM IST 40Days Online -

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Wednesday, June 10, 2009

How to update a particulare line in a text file?

'**************************************************************
txtFilePath= "C:\abc.txt"
txtRowNumber=3 ' Row number to update
TextToAdd="three"

Set fso= CreateObject( "scripting. FilesystemObject ")
Set f=fso.OpenTextFile( txtFilePath, 1)
txtData=f.readall
f.close

Set f=fso.OpenTextFile( txtFilePath, 2)

strTxtData=split( txtData,vbnewlin e)

For cnt=0 to ubound(strTxtData)


If cnt<>txtRowNumber- 1 Then
    f.writeline( strTxtData( cnt))
else
    f.writeline( TextToAdd )
End If

Next

f.close
'**************************************************************

No comments :

Post a Comment