Function for comaprison of contents of two text files - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Function for comaprison of contents of two text files (/Thread-Function-for-comaprison-of-contents-of-two-text-files) |
Function for comaprison of contents of two text files - joshsri - 09-07-2008 Hi Everyone, My Greetings. I have an Issue.I have to COMPARE the contents of two text files. For your kind reference i have written my piece of code here : ------------------------------------------------------------ Code: Const ForReading = 1, ForWriting = 2 This works fine. But,I have two/three conditions to be met here. 1. I want the textfiles NOT to be hardcoded. 2. I want this to be written as a function. 3. Also, my First file is static ie the first file is the expected result. My Other two files are generated during runtime. ie the 2nd file which would store Actual result and the 3rd file which would be the differences. Like if my QAManager writes like this , it should work. Call FnComptext(tf1,tf2). It should compare and store the diff in another file. Plz Help. Thanks a ton, Josh Q RE: Function for comaprison of contents of two text files - Ankur - 09-07-2008 If I understood your question correctly, you want to compare two files CurrentDIR.txt and LOG.txt and store their differences in a file name Files2Download.txt Here is how you can convert it into a function. Code: Function Comp (text_file1, text_file2, diff_file) you can call this function by : Comp C:\CurrentDIR.txt, C:\LOG.txt, C:\Files2Download.txt |