SalFileHandle
Namespace: PPJ.Runtime
Assembly: PPJ.Runtime.49 (4.9.0.0)
- C#
- VB.NET
public struct SalFileHandle : ValueType, ISerializable, IXmlSerializable
Public Structure SalFileHandle
Implements ValueType, ISerializable, IXmlSerializable
Properties
FileStream
FileStream: Returns the wrapped FileStream object.
Handle
IntPtr: Returns the handle for this SalFileHandle object
IsBinary
Boolean: Returns true if the file was opened in binary mode.
IsNull
Boolean: Checks if this SalFileHandle object contains a null value.
LastError
Int32: Returns the last error code.
Methods
Close()
Closes a file.
Returns: Boolean. bOk
Copy(sSourcePath, sDestPath, bOverWrite)
Copies the contents of one file (source) to another file (destination).
| Parameter | Type | Description |
|---|---|---|
| sSourcePath | SalString | The full path name of the source file. |
| sDestPath | SalString | The full path name of the destination file. |
| bOverWrite | SalBoolean | Specifies whether (TRUE) or not (FALSE) to overwrite the destination file. If the destination file already exists and bOverWrite is FALSE, then SalFileCopy fails, and returns FILE_CopyExist. If the destination file already exists and bOverWrite is TRUE, then SalFileCopy succeeds and the destination file is overwritten. |
Returns: SalNumber. nStatus
CreateDirectory(sDir)
Creates a directory.
| Parameter | Type | Description |
|---|---|---|
| sDir | SalString | The full path name of the new directory. |
Returns: SalBoolean. bOk
FromHandle(handle)
Returns the SalFileHandle object from the handle
| Parameter | Type | Description |
|---|---|---|
| handle | IntPtr |
Returns: SalFileHandle.
GetChar()
Returns the next character in an open file.
Returns: SalNumber. nChar
GetChar(nChar)
| Parameter | Type | Description |
|---|---|---|
| nChar | SalNumber& |
Returns: Boolean.
GetCurrentDirectory(sPath)
| Parameter | Type | Description |
|---|---|---|
| sPath | SalString& |
Returns: SalBoolean.
GetDateTime(sFilename, dtDateTime)
| Parameter | Type | Description |
|---|---|---|
| sFilename | SalString | |
| dtDateTime | SalDateTime& |
Returns: SalBoolean.
GetDrive()
Gets the letter of the default (current) disk drive.
Returns: SalString. sDriveLetter
GetObjectData(info, context)
| Parameter | Type | Description |
|---|---|---|
| info | SerializationInfo | |
| context | StreamingContext |
GetString(maxLength)
Returns the next line from an open file. Lines are terminated by \r\n or \r or \n
| Parameter | Type | Description |
|---|---|---|
| maxLength | Int32 |
Returns: SalString.
GetString(line, maxLength)
| Parameter | Type | Description |
|---|---|---|
| line | SalString& | |
| maxLength | Int32 |
Returns: Boolean.
Open(fileName, flags)
Opens, re-opens, creates, or deletes a file.
| Parameter | Type | Description |
|---|---|---|
| fileName | String | The name of the file to open, create, delete, or test. |
| flags | Int32 | A constant that specifies the style in which to open the file. nStyle can be one or more styles combined using the bitwise OR (|) operator. |
Returns: Boolean. bOk
Open(fileName, flags, encoding)
Opens, re-opens, creates, or deletes a file.
| Parameter | Type | Description |
|---|---|---|
| fileName | String | The name of the file to open, create, delete, or test. |
| flags | Int32 | A constant that specifies the style in which to open the file. nStyle can be one or more styles combined using the bitwise OR (|) operator. |
| encoding | Encoding | Encoder used to read/write characters. |
Returns: Boolean. bOk
PutChar(c)
Writes a character to an open file.
| Parameter | Type | Description |
|---|---|---|
| c | Int32 | The ANSI numeric value of the character to write to hFile. |
Returns: Boolean. bOk
PutString(text)
Writes a string to an open file.
| Parameter | Type | Description |
|---|---|---|
| text | String | The string to write. |
Returns: Boolean. bOk
Read(maxLength)
Reads a buffer of characters from an open file to a string .
| Parameter | Type | Description |
|---|---|---|
| maxLength | Int32 |
Returns: SalString.
Read(buffer, maxLength)
| Parameter | Type | Description |
|---|---|---|
| buffer | SalString& | |
| maxLength | Int32 |
Returns: SalNumber.
Read(buffer, maxLength)
| Parameter | Type | Description |
|---|---|---|
| buffer | SalBinary& | |
| maxLength | Int32 |
Returns: SalNumber.
RemoveDirectory(sDir)
Deletes a directory.
| Parameter | Type | Description |
|---|---|---|
| sDir | SalString | The full path name of the directory to delete. |
Returns: SalBoolean. bOk
Seek(bytes, position)
Positions the file pointer in an open file. The next file operation (such as a read or write) takes place at this new location.
| Parameter | Type | Description |
|---|---|---|
| bytes | Int32 | The specific position of the file pointer; the number of bytes from nPosition where the next file operation will take place. |
| position | Int32 | The general position of the file pointer; one of the following values: FILE_SeekBegin FILE_SeekCurrent FILE_SeekEnd |
Returns: Boolean. bOk
SetCurrentDirectory(sPath)
Changes the current working directory. If the specified path does not contain a drive letter, the default drive's current directory is changed. Otherwise, the specified drive's current directory is changed and the specified drive is made the current drive.
| Parameter | Type | Description |
|---|---|---|
| sPath | SalString | The path name of the new current working directory. |
Returns: SalBoolean. bOk
SetDateTime(sFilename, dtDateTime)
Sets the modification date and time of the specified file.
| Parameter | Type | Description |
|---|---|---|
| sFilename | SalString | The name of the file whose modification date you want to set. |
| dtDateTime | SalDateTime | The modification date and time. |
Returns: SalBoolean. bOk
SetDrive(sDriveLetter)
Sets the current disk drive to the specified drive letter.
| Parameter | Type | Description |
|---|---|---|
| sDriveLetter | SalString | The new disk drive letter. The length of this parameter's value is one character. |
Returns: SalBoolean. bOk
Tell()
Returns the current position in an open file.
Returns: SalNumber. nPos
Write(str, length)
Writes a string to an open file.
| Parameter | Type | Description |
|---|---|---|
| str | SalString | The string to write to hFile. |
| length | Int32 | The number of bytes to write. |
Returns: SalNumber.
Write(binary, length)
Writes a binary buffer to an open file.
| Parameter | Type | Description |
|---|---|---|
| binary | SalBinary | The string to write to hFile. |
| length | Int32 | The number of bytes to write. |
Returns: SalNumber.
Used By
| Name | Description |
|---|---|
| Sal.WindowHandleToNumber | Converts a SalFileHandle to a number. |
| Sal.FilePutChar | Writes a character to an open file. |
| Sal.FilePutStr | Writes a string to an open file and appends a carriage return/line feed character to the string. |
| Sal.FileRead | |
| Sal.FileSeek | Positions the file pointer in an open file. The next file operation (such as a read or write) takes place at this new location. |
| Sal.FileTell | Returns the current position in an open file. |
| Sal.FileWrite | Writes a string to an open file. |
| Sal.FileGetChar | |
| Sal.FileGetStr | |
| SalFileHandle.FromHandle | Returns the SalFileHandle object from the handle |
| Vis.FileClose | |
| Vis.FileRead | |
| Vis.FileReadString | |
| Vis.FileReadBinary | |
| Vis.FileSeek | |
| Vis.FileTell | |
| Vis.FileWrite | |
| Vis.FileWriteString | |
| Vis.FileWriteBinary | |
| XSal.GZipPutChar |