Open Means Open Means

Definition Of File:

A file is a collection of data that is named and saved on the secondary storage. Contents of file can be retrieved and modified as per requirement.

Classification Of Files:

Files can be classified into three based on the mode of access. They are,
1. Sequential access mode.
2. Binary access mode.
3. Random access mode.

Generic procedure of processing files

In VB we can read files, create files, write to the files, modify files and also delete files.  The generic procedure of doing so is as follows:
1. Open the file.
2. Now process the file as per our requirement.
3. Close the file.

Handling files and folders using functions:

1. Kill ( ) function:

It is used to delete the specified file from the disk.
Eg : Kill (“C:\Files\aaa.txt”)

2. FileDateTime ( ) function:

It is used to return the date and time of creation of the specified file.
Eg : Str= FileDateTime(“C:\Files\aaa.txt”)

3. FileLen( ) function:

It is used to return the length of the file specified in bytes.
Eg : Length=FileLen(“C:\Files\aaa.txt”)

4. MkDir( ) function:
It is used to create new folder.
Eg : MkDir(“C:\Myfiles”)

5. RmDir( ) function:

It is used to delete the folder specified.
Eg : RmDir(“C:\Myfiles”)

6. ChDir( ) function:

It is used to change the current folder.
Eg : ChDir(“C:\Files”)

7. ChDrive( ) function:

It is used to change the current drive.
Eg : ChDrive(“A”)

8. CurDir( ) function:

It is used to return the name of the current directory.
Eg : Name= CurDir( )

9. Dir( ) function:

It is used to check whether the file is exist or not. It will return boolean value as result.
Eg :
Dim Exist as Boolean
Exist=Dir(“C:\Files\aaa.txt”)

10. FileCopy( ) function :

It is used to copy the file from one location to another.
Syntax :
FileCopy(“Source file path”,“Destination file path”)
Eg :
FileCopy( “ C:\Files\aaa.txt” , “C:\Files\bbb.txt” )

11. Rename( ) function:
It is used  to rename the file.
Syntax  :
Rename(“Oldname”,“Newname”)
Eg :
Rename(“C:\Files\bbb.txt”,“C:\Files\ccc.txt”)

 

That's it...

Thankyou,

Rajkumar

No comments

Login to post a comment

Show
  • Create an account
  • Forgot your username?
  • Forgot your password?

Related Articles

  • CSS - Cascading Style Sheet
  • Java Puzzle - Problem of Two Developers
  • Java Puzzle - Problem of Two Developers Part 2
  • C Program to compare two numbers.....
  • C Program to add two numbers.....
  • Tips and Tricks to improve the your computer security.
  • Most Dangerous Computer Viruses of the Century
  • An overview of computer Networks
  • Introduction to C Language
  • Online Money Making Through PTC
  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions