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

What is #ifdef ? What is its application?

651


What is assignment operator?

630


Not all reserved words are written in lowercase. TRUE or FALSE?

721


How can you return multiple values from a function?

636


What is the purpose of main( ) in c language?

625






What is the most efficient way to count the number of bits which are set in an integer?

595


What is the difference between class and object in c?

585


What are global variables and how do you declare them?

623


What is the difference between c and python?

588


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

605


Do character constants represent numerical values?

846


What are the differences between new and malloc in C?

612


How variables are declared in c?

574


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2124


What are extern variables in c?

551