write code to read and write data from file?



write code to read and write data from file?..

Answer / 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

More QTP Interview Questions

where the object repository is located?how to choose the object repository as shared or action object repositories?

4 Answers   Datamatics,


Do we get any issues if we run the test script on differentbrowsers?what are the options we need to set in QTP?

3 Answers   CTS,


what is mercury.clipboard in qtp.where we can get this in qtp tool i.e tabs

1 Answers  


I had installed QTP 9.2. It is working fine but whenever I open QTP, it is trying to reinstall the below-mentioned files again and again "QTP92PS82UPGRADE.exe", "recogn.dll". If anybody has these files, please provide those files in this site or you can send that files to my mail id also (lravi4u@yahoo.com). If you don't know where the files will be in the QTP, search in the QTP software CD or path of QTP program installed (C:\Program Files\Mercury Interactive\QuickTest Professional)

0 Answers  


Can we directly automate test script according to requirements?

1 Answers  






What is the another extention name of library file.If that is exist than what's the differnce between them.

1 Answers   Synechron,


If you entered into yahoo mail with your valid user name and password , then you will get " welcome , username " (for example you will see , “welcome, Krishna” ) text on the top of the Inbox page , how can you test the user name is correct or not using QTP?

3 Answers   CTS,


Check point what is how many types of checkpoint and explain

3 Answers   Accenture,


recording is not a good programming practice.How to write effective script without recording.Which is the correct method explain in detail

3 Answers   Infosys,


1.How to find in which row or column,string "Hyderabad" exist in excel sheet? 2.How to find how many times character "a" repeated in a given string "Koteswararao"

6 Answers   Ness Technologies,


To which environments does quicktest professional (qtp) supports?

0 Answers  


i am giving.multiple names like ram,raj,san etc....pls enter & search these names in google pade edit box through script... i told to interviewer, using Ms excel & test easily..but interviwer not happy with that answer?

2 Answers   Accenture,


Categories