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

There is an excel file of 1 to 100 sheets how you will iterate through it?

532


What are the disadvantages of recording test cases in qtp?

597


Is it possible to call win runner script in qtp?

627


Could i know how how to explain keyword driven framework in interview? If any body knows plz send the explanation.

1613


When do go for loop condition in test?

654






How to do the scripting. Are there any inbuilt functions in QTP? What is the difference between them? How to handle script issues?

576


What are the Disadvantages of shared object repository?

573


Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance

1525


How you can write contexts to text file in qtp?

592


How may types of defects identify application or your currently working application?pls give me answer..

1517


explain abt dyanamic changing object with example?

1903


is there any addin for remedy user application

1745


When and why to use descriptive programming?

612


how to fetch the values from grid? & qtp recogniges that grid as a webelement? what u do?

1910


What is checkpoints for quicktest professional?

551