Answer Posted / yogesh
'MERGE CONTENTS OF TWO FILE
Option Explicit
Const conForReading = 1
Const ForAppending = 8
Dim objFSO: Set objFSO = CreateObject
("Scripting.FileSystemObject")
Dim file1,file2,file3,contents1,contents2
Dim strfile1,strfile2,strfile3 'Declare
variables
strfile1=inputbox("Enter path of Source file 1","Copy file
utility"," ")
strfile2=inputbox("Enter path of Source file 2","Copy file
utility"," ")
strfile3=inputbox("Enter path of To Create Target
file","Copy file utility"," ")
Set file1 = objFSO.OpenTextFile(strfile1, conForReading,
False)
Set file2 = objFSO.OpenTextFile(strfile2, conForReading,
False)
Set file3 = objFSO.CreateTextFile(strfile3, ForAppending,
True)
'Set Objects
contents1 = file1.ReadAll
contents2 = file2.ReadAll
'Read file contents
file1.Close
file2.Close
'Close file after use
file3.WriteLine(contents1)
file3.writeLine(contents2)
'Write contents to file
file3.Close
'Close file after use
Set file1 = Nothing
Set file2 = Nothing
Set file3 = Nothing
Set objFSO = Nothing
'freezing memory of objects
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
what do the 'c' and 'v' in argc and argv stand for?
How can you avoid including a header more than once?
Write a program to print fibonacci series without using recursion?
What is clrscr ()?
What does calloc stand for?
What functions are used in dynamic memory allocation in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
Why do we write return 0 in c?
Is r written in c?
What is hashing in c?
What are the types of macro formats?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Do string constants represent numerical values?
What is ## preprocessor operator in c?
to find the closest pair