==============================
JF Software VB Modules
By Joshua Foster - JF Software
http://www.jfsoftware.net
jfsoftware@jfsoftware.net
June 25, 2001
==============================
File class module
=================
Description: A collection of routines for file manipulation


Procedures:
===========
-----
OpenF
-----
Syntax:            OpenF(lngSlotNumber As Long, strFile As String, vrbType As OpenFileVerbs, blnMustExist As Boolean) As _
                   Boolean
Description:       Opens or creates a file for input or output.
Return Value:      Returns true if successful, false if an error occured.  Also, returns properties of the file opened in the
                   return properties listed below.
Parameters:        lngSlotNumber - The number of the slot to use (must be between 1 and 255)
                   strFile       - The path of the file to open.
                   vrbType       - A flag telling the procedure what mode to open the file for. (type OpenFileVerbs)
                   blnMustExist  - If true, then the file in strFile must exist.  If false, then if the file in strFile
                                   doesn't exist, it is created.
Types:             Name:        OpenFileVerbs
                   Description: The flags controlling what mode a file is opened for.
                   Members:     OFVread:  Opens the file for read access
                                OFVwrite: Opens the file for write access
Return Properties: Name:        Archive(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The file's Archive property.

                   Name:        Compressed(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The file's Compressed property.

                   Name:        Hidden(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The file's Hidden property.

                   Name:        ReadOnly(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The file's Read-Only property.

                   Name:        System(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The file's System property.

                   Name:        VolumeSerialNumber(ByVal lngSlotNumber As Long)
                   Type:        Long (Read-only)
                   Description: The serial number of the volume that the file is on.

                   Name:        FileSizeLong(ByVal lngSlotNumber As Long)
                   Type:        Long (Read-only)
                   Description: A numerical representation of the size of the file.

                   Name:        FileSizeStr(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: A string representation of the size of the file.

                   Name:        FileHandle(ByVal lngSlotNumber As Long)
                   Type:        Long (Read-only)
                   Description: The handle to the file opened.

                   Name:        ShortFileName(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The 8.3 file name and extension only of the file.

                   Name:        ShortPathFile(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The 8.3 path name, file name, and extension of the file.

                   Name:        Extension(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The extension only of the file.

                   Name:        FileName(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The file name and extension only of the file.

                   Name:        PathName(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The path name only of the file.

                   Name:        PathFile(ByVal lngSlotNumber As Long)
                   Type:        Boolean (Read-only)
                   Description: The path name, file name, and extension of the file.

                   Name:        FilePos(ByVal lngSlotNumber As Long)
                   Type:        Long (Read-only)
                   Description: The position of the file pointer (where Read operations start).

                   Name:        FileMode(ByVal lngSlotNumber As Long)
                   Type:        String (Read-only)
                   Description: The current mode of the file.
                                * "Empty" - No file exists in this slot.
                                * "Read"  - The file in this slot is opened for Reading.
                                * "Write" - The file in this slot is opened for Writing.

Example:
--------
Private cFile As File  'Define a File object

Private Sub Form_Load()
Set cFile = New FileSystemClass  'Load the cFileSys object
'Open the file "C:\MyApp\tester.txt" for reading (create if non-existent) in slot 1
Call cFileSys.OpenFile(1, "C:\MyApp\tester.txt", OFVread, False)
'MsgBox the size of the file
MsgBox cFile.FileSizeStr


------
WriteF
------
Syntax:       WriteF(lngSlotNumber As Long, anyText) As Boolean
Description:  Writes to a file previously opened.
Return Value: Returns true if successful, false if an error occured.
Parameters:   lngSlotNumber - The number of the slot to write to (must be between 1 and 255)
              anyText       - The number or text to write to the file.

Example:
--------
'MsgBox the result of a file write
MsgBox cFileSys.WriteToFile(1, "Hello!")


---------
ReadBytes
---------
Syntax:       ReadBytes(lngSlotNumber As Long, lngNumBytes As Long)
Description:  Reads a certain number of bytes from a file, starting at the current file pointer.
Return Value: Returns the text requested, or False if an error occured.
Parameters:   lngSlotNumber - The number of the slot to read from (must be between 1 and 255)
              lngNumBytes   - The number of bytes to read from the file.

Example:
--------
'MsgBox the result of a 60-byte file read
MsgBox cFileSys.ReadBytes(1, 60)


--------
ReadLine
--------
Syntax:       ReadLine(lngSlotNumber As Long) As String
Description:  Reads from a file until a carriage return is found, starting at the current file pointer.
Return Value: Returns the text requested, or "EOF" if there is no more text.
Parameters:   lngSlotNumber - The number of the slot to read from (must be between 1 and 255)
              lngNumBytes   - The number of bytes to read from the file.

Example:
--------
'MsgBox the result of a line read from a file
MsgBox cFileSys.ReadLine(1)


---------
MoveStart
---------
Syntax:       MoveStart(lngSlotNumber As Long) As Boolean
Description:  Moves the file pointer to the beginning of the file.
Return Value: Returns true if successful, false if an error occured.
Parameters:   lngSlotNumber - The number of the slot to use (must be between 1 and 255)

Example:
--------
'Move the file pointer to the beginning.
Call cFileSys.MoveStart(1)


-------------
FirstOpenSlot
-------------
Syntax:       FirstOpenSlot() As Long
Description:  Finds the first open file slot.
Return Value: Returns the number of the first available file slot.

Example:
--------
'MsgBox the first empty file slot.
MsgBox cFileSys.MoveStart(1)


------
CloseF
------
Syntax:       CloseF(lngSlotNumber As Long) As Boolean
Description:  Closes a file opened with OpenF.
Return Value: Returns true if successful, false if an error occured.
Parameters:   lngSlotNumber - The number of the slot to close (must be between 1 and 255)

Example:
--------
'MsgBox the result of a file close
MsgBox cFileSys.CloseFile(filehnd)
