write code to read and write data from file?

Answer Posted / rdshet

Hi,

Set fso = CreateObject("Scripting.FilesyStemObject")
Set fil = fso.CreateTextFile("D:\test.txt", TRUE)
fil.writeline "this is text 1 " ' Writing
fil.writeline "this is text 2 "
fil.writeline "this is text 3 "
fil.close

IF fso.FileExists("D:\test.txt") =TRUE Then
Set fil1 =fso.OpenTextFile ("D:\test.txt",1)

DO WHILE NOT fil1.atendofstream
flread = fil1.ReadLine 'Reading
msgbox flread
LOOP
flread.close
Set flread = NOTHING
END IF

Set fil = NOTHING
Set fso = NOTHING


Regds
Raghavendra

Please correct me if am wrong.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference betn QTP 8.0 AND PREVIOUS VERSION

2204


How do I generate Test Results window using descriptive method ( run time ) after my test execution process? Please have a look of my below code. ========================================================= Dim qtApp Dim qtTest Dim qtResultsOpt Set qtApp = CreateObject("QuickTest.Application") qtApp.Launch qtApp.Visible = True qtApp.Options.Run.CaptureForTestResults = "Always" qtApp.Options.Run.RunMode = "Fast" qtApp.Options.Run.ViewResults = True qtApp.Open "C:\Automation\Example", True Set qtTest = qtApp.Test qtTest.Settings.Run.OnError = "NextStep" Set qtResultsOpt = CreateObject ("QuickTest.RunResultsOptions") qtResultsOpt.ResultsLocation = "C:\Automation\Example\Res1" qtTest.Run qtResultsOpt MsgBox qtTest.LastRunResults.Status qtTest.Close Set qtResultsOpt = Nothing Set qtTest = Nothing Set qtApp = Nothing ========================================================== This code is working fine, but Test Result window is not displaying after execution. Anybody can please help me regading the same. Thanks Akshaya Madali Capgemini India Pvt Ltd 9823213538

4002


What ate the Technologies supported by QTP?

914


How many types of recording modes in qtp?

812


What are the trigger events in qtp?

816


Where you get the run time data table?

782


How will you test a keyboard?

823


How to test the login page in different ways in automation testing and i need code?

1569


can test automation improve test effectiveness?

1728


How to make qtp understand the difference amongst the same type of objects .suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?

754


What is a recovery scenario?

799


How do you capture tooltip using QTP?

821


Hi am New to Automation Testing , any one can you help me what are the basic questiion are asked an interview?

1651


Hi Every body please explain me in steps to use checkpoints and object Repositories in QTP for Flight Reservation application please tell me the steps for this its urgent pls thanx for urs answers

1832


How to start recording using quicktest professional (qtp)?

806