This is a discussion on how to write into notepad file through winrunner? within the Testing Tutorials forums, part of the Articles and Tutorials category; Hi group! how can we copy one line written in a notepad file to another notepad file.. and suppose there ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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.. |
|
|||
|
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 |
|
|||
|
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 |