QTP Script to add a new line at the beginning of a text file-QTP Script to append a new line at the beginning of a text file

QTP Script to add a new line at the beginning of a text file-QTP Script to append a new line at the beginning of a text file



Const ForReading = 1



Const ForWriting = 2



fileName = "C:\qtp1.txt"



Set fso = CreateObject( "Scripting.FileSystemObject" )



Set textFile = fso.OpenTextFile(fileName, ForReading )



contents = textFile.ReadAll



textFile.Close



firstLine = "New Line Added"



newContent = firstLine & vbCrLf & contents



Set textFile = fso.OpenTextFile( fileName, ForWriting )



textFile.WriteLine newContent





No comments:

Related Posts Plugin for WordPress, Blogger...