Exforsys
+ Reply to Thread
Results 1 to 3 of 3

how to write into notepad file through winrunner?

This is a discussion on how to write into notepad file through winrunner? within the Software Testing forums, part of the Testing category; Hi group! how can we copy one line written in a notepad file to another notepad file.. and suppose there ...

  1. #1
    mangalsachin2002 is offline Junior Member Array
    Join Date
    Feb 2005
    Answers
    10

    how to write into notepad file through winrunner?

    Hi group!

    how can we copy one line written in a notepad file to another notepad file.. and suppose there are three words in this notepad file now i want to write every word in a new line in the new note pad file through winrunner.. plz help me..


  2. #2
    nexus59 is offline Junior Member Array
    Join Date
    Sep 2004
    Answers
    7
    1) open a text file say "foo1.txt" in read mode. function is file_open()
    2) open another text file say "foo2.txt" in write mode
    3) you need to get row count to know the total # of lines in foo1.txt file.
    so use ddt_open() on foo1.txt and ddt_get_row_count()
    4) for( ) //use the count variable for condition within for loop
    file_getline() on foo1.txt
    file_printf() on foo2.txt //
    end for loop.
    5) file_close() on foo1.txt and foo2.txt

    if foo1.txt contents are
    SAM
    TOM
    after executing the pgm , foo2.txt should contain
    SAM
    TOM


  3. #3
    nexus59 is offline Junior Member Array
    Join Date
    Sep 2004
    Answers
    7
    sachin try this one:

    file_open(f1.txt);
    file_open(f2.txt);

    table = "C:\\f1.txt";
    rc = ddt_open(table, DDT_MODE_READ);
    if (rc!= E_OK && rc != E_FILE_OPEN)
    pause("Cannot open table.");
    ddt_get_row_count(table,Count);
    for(i=0;i<=Count;i++)
    {
    file_getline(f1.txt,input);

    split(input,v," ");

    file_printf("C:\\f2.txt","%s\r\n%s\r\n%s",v[1],v[2],v[3]);
    }

    file_close(f1.txt);
    file_close(f2.txt);

    f1.txt = i am sachin
    f2.txt = i
    am
    sachin


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...