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

what is verification & validation?

2 Answers   Accenture, TCS,


which tpye of exceptions mostly do we face in QTP

2 Answers  


synchronization, wait,wait Property?

1 Answers  


I am just a beginner in QTP. Could any one explain me in detail how to automate adding two numbers and getting the result in QTP. Also I would like to parameterize the inputs. I have tried but getting an error like 'Can't use sub.....'(can't recollect the exact error)

2 Answers  


How to Display last item of a Combobox by using QTP?

10 Answers  






What will be the script for recovery scenerio.plzanyone give ans with aexample related to banking project

2 Answers   Yahoo,


What do you mean by iteration?

0 Answers  


what is bultin funtaion in QTP &tell me five examples?

5 Answers   Kanbay,


want to learn real time automation project(QTP)?

1 Answers  


Explain about the Test Fusion Report of QTP?

1 Answers   Crea,


I need diffrences between Object Identification, Smart Identification, Regular expresion,Low-Level Recording (enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation.) I am working on Web Application. In that object caption will change dynamically. For example, consider “Save” button. On clicking save button the caption changing as “ EDIT ”. From above concept which concept I have to use here?

2 Answers   Ordain Solutions,


7. Given scenario is like this: One Web table is there and you have to search and retrieve a cell data which is equal to the given number say:123. Assume you have given with the column name/id of the table where the number may exist. So now you have to go to the given column and search for the number 123 and retrieve it along with the row number of it.

4 Answers  


Categories