yogesh patil in dell

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


Please Help Members By Posting Answers For Below Questions

Are the variables argc and argv are local to main?

780


Explain how do you list a file’s date and time?

615


What is meant by inheritance?

622


Explain threaded binary trees?

670


Can a local variable be volatile in c?

571






Write a program to identify if a given binary tree is balanced or not.

678


Do character constants represent numerical values?

833


What is the best organizational structure?

635


Why c is called object oriented language?

576


What is the scope of local variable in c?

568


Define VARIABLE?

684


Explain how do you convert strings to numbers in c?

590


Differentiate between a for loop and a while loop? What are it uses?

663


Explain what is the benefit of using #define to declare a constant?

604


What does 2n 4c mean?

703