yogesh patil in dell

Answers were Sorted based on User's Feedback



yogesh patil in dell..

Answer / 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

yogesh patil in dell..

Answer / yogesh

option explicit
Dim objFSO: Set objFSO = CreateObject
("Scripting.FileSystemObject")
Dim colDrives:Set colDrives = objFSO.Drives
Dim objDrive,path,s
For Each objDrive in colDrives
path=objDrive.DriveLetter&":"
SearchPath(Path)


Next



Function SearchPath(Path) ' Defination of function
Dim BigFile,BigSize:BigSize=0
Dim objFSO: Set objFSO = CreateObject
("Scripting.FileSystemObject")
Dim objfolder:Set objfolder= objFSO.GetFolder(path &"\")
Dim ColSubFolders:Set ColSubFolders=objfolder.subfolders
Dim ObjSubFolder,objFile,colFiles
For each ObjSubFolder in ColSubFolders
Set colFiles=objfolder.files
For each objFile in colFiles
if(objFile.size>BigSize) then
BigSize=objFile.size
BigFile=objFile.name
end if
next
next
msgbox BigFile &BigSize
End Function

Is This Answer Correct ?    0 Yes 0 No

yogesh patil in dell..

Answer / yogesh

'CREATE FOLDER STRUCTURE

Option Explicit

Dim objFSO:Set objFSO = CreateObject
("Scripting.FileSystemObject")
Dim strDirectory:strDirectory=inputbox("Enter
path ","Create folder utility"," ")

'Declare variables
GeneratePath(strDirectory)
'Call to Function


Function GeneratePath(pFolderPath) ' Defination of function
GeneratePath = False
If Not objFSO.FolderExists(pFolderPath) Then
If GeneratePath(objFSO.GetParentFolderName(pFolderPath))
Then 'Recursive call to function
GeneratePath = True
Call objFSO.CreateFolder(pFolderPath)
End If
Else
GeneratePath = True
End If
End Function

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

What is a buffer in c?

0 Answers  


What is the purpose of void pointer?

0 Answers  


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

0 Answers  


What are the types of i/o functions?

0 Answers  


Is it possible to use curly brackets ({}) to enclose single line code in c program?

0 Answers  






What is variable declaration and definition in c?

0 Answers  


What is c++ used for today?

0 Answers  


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  


What's the best way of making my program efficient?

0 Answers   Celstream,


what is ANSI and ISO

7 Answers   HCL,


what is the size of an integer variable?

4 Answers  


What is structure of c program?

0 Answers  


Categories