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

Give answer with example what is orthogonal array testing technique?

1 Answers   CTS, Wipro,


How do you change Logical Name of the object in test script?

1 Answers   TCS,


How do u write script in qtp? where do u write?

2 Answers  


How does qtp identify gui object?

0 Answers  


How many types of recording modes in the qtp?

0 Answers  






Is there any option in QTP to add Java add-in after instaling the QTP?

3 Answers   IBM,


A FORM CONTAINS 5 FIELDS. 1 FIELD IS ENABLED REMAINING(4) FIELDS DISABLED. MY QUESTION IS ENTER VALUES INTO 1 FIELD AFTER THAT CLICK TAB BUTTON THEN 2 FIELD ENABLE THIS PROCESS CONTINUE UPTO 5TH FIELD. HOW TO WRITE CODE IN DESCRIPTIVE PROGRAMMING. PLZ TELL ME THE PROCEDURE AND CODE FOR IT.

0 Answers   TCS,


how qtp will recognise if application is run on many browsers

1 Answers   Cap Gemini,


Explain how you can delete excel file in qtp?

0 Answers  


what is the script for keyword driven framework in real time?plz its urgent

1 Answers   Accenture, CTS,


What is the difference between keyword view and expert view?

0 Answers  


when qtp recognizes a web link like (hyper link)wich properties it is going to take to identify the objects unquely? what is Ini file in QTP?

1 Answers   Symantic Space,


Categories