Skip to main content
Version: 2023

SalFileHandle

Namespace: PPJ.Runtime

Assembly: PPJ.Web.49 (4.9.0.0)

public struct SalFileHandle : ValueType, ISerializable, IXmlSerializable

Properties

Instance memberHandle

IntPtr: Returns the handle for this SalFileHandle object

Instance memberIsBinary

Boolean: Returns true if the file was opened in binary mode.

Instance memberIsNull

Boolean: Checks if this SalFileHandle object contains a null value.

Instance memberLastError

Int32: Returns the last error code.

Instance memberStream

Stream: Returns the wrapped FileStream object.

Methods

Instance memberClose()

Closes a file.

Returns: Boolean. bOk

Static memberCopy(sSourcePath, sDestPath, bOverWrite)

Copies the contents of one file (source) to another file (destination).

ParameterTypeDescription
sSourcePathSalStringThe full path name of the source file.
sDestPathSalStringThe full path name of the destination file.
bOverWriteSalBooleanSpecifies 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

Static memberCreateDirectory(sDir)

Creates a directory.

ParameterTypeDescription
sDirSalStringThe full path name of the new directory.

Returns: SalBoolean. bOk

Static memberFromHandle(handle)

Returns the SalFileHandle object from the handle

ParameterTypeDescription
handleIntPtr

Returns: SalFileHandle.

Instance memberGetChar()

Returns the next character in an open file.

Returns: SalNumber. nChar

Instance memberGetChar(nChar)

ParameterTypeDescription
nCharSalNumber&

Returns: Boolean.

Static memberGetCurrentDirectory(sPath)

ParameterTypeDescription
sPathSalString&

Returns: SalBoolean.

Static memberGetDateTime(sFilename, dtDateTime)

ParameterTypeDescription
sFilenameSalString
dtDateTimeSalDateTime&

Returns: SalBoolean.

Static memberGetDrive()

Gets the letter of the default (current) disk drive.

Returns: SalString. sDriveLetter

Instance memberGetObjectData(info, context)

ParameterTypeDescription
infoSerializationInfo
contextStreamingContext

Instance memberGetString(maxLength)

Returns the next line from an open file. Lines are terminated by \r\n or \r or \n

ParameterTypeDescription
maxLengthInt32

Returns: SalString.

Instance memberGetString(line, maxLength)

ParameterTypeDescription
lineSalString&
maxLengthInt32

Returns: Boolean.

Instance memberOpen(fileName, flags)

Opens, re-opens, creates, or deletes a file.

ParameterTypeDescription
fileNameStringThe name of the file to open, create, delete, or test.
flagsInt32A 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

Instance memberOpen(fileName, flags, encoding)

Opens, re-opens, creates, or deletes a file.

ParameterTypeDescription
fileNameStringThe name of the file to open, create, delete, or test.
flagsInt32A constant that specifies the style in which to open the file. nStyle can be one or more styles combined using the bitwise OR (|) operator.
encodingEncodingEncoder used to read/write characters.

Returns: Boolean. bOk

Instance memberPutChar(c)

Writes a character to an open file.

ParameterTypeDescription
cInt32The ANSI numeric value of the character to write to hFile.

Returns: Boolean. bOk

Instance memberPutString(text)

Writes a string to an open file.

ParameterTypeDescription
textStringThe string to write.

Returns: Boolean. bOk

Instance memberRead(maxLength)

Reads a buffer of characters from an open file to a string .

ParameterTypeDescription
maxLengthInt32

Returns: SalString.

Instance memberRead(buffer, maxLength)

ParameterTypeDescription
bufferSalString&
maxLengthInt32

Returns: SalNumber.

Instance memberRead(buffer, maxLength)

ParameterTypeDescription
bufferSalBinary&
maxLengthInt32

Returns: SalNumber.

Static memberRemoveDirectory(sDir)

Deletes a directory.

ParameterTypeDescription
sDirSalStringThe full path name of the directory to delete.

Returns: SalBoolean. bOk

Instance memberSeek(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.

ParameterTypeDescription
bytesInt32The specific position of the file pointer; the number of bytes from nPosition where the next file operation will take place.
positionInt32The general position of the file pointer; one of the following values: FILE_SeekBegin FILE_SeekCurrent FILE_SeekEnd

Returns: Boolean. bOk

Static memberSetCurrentDirectory(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.

ParameterTypeDescription
sPathSalStringThe path name of the new current working directory.

Returns: SalBoolean. bOk

Static memberSetDateTime(sFilename, dtDateTime)

Sets the modification date and time of the specified file.

ParameterTypeDescription
sFilenameSalStringThe name of the file whose modification date you want to set.
dtDateTimeSalDateTimeThe modification date and time.

Returns: SalBoolean. bOk

Static memberSetDrive(sDriveLetter)

Sets the current disk drive to the specified drive letter.

ParameterTypeDescription
sDriveLetterSalStringThe new disk drive letter. The length of this parameter's value is one character.

Returns: SalBoolean. bOk

Instance memberTell()

Returns the current position in an open file.

Returns: SalNumber. nPos

Instance memberUse(stream, flags)

Uses the specified stream .

ParameterTypeDescription
streamStreamThe stream to read or write.
flagsInt32A constant that specifies the style in which to used the stream. nStyle can be one or more styles combined using the bitwise OR (|) operator.

Returns: Boolean. bOk

Instance memberUse(stream, flags, encoding)

Uses the specified stream .

ParameterTypeDescription
streamStreamThe stream to read or write.
flagsInt32A constant that specifies the style in which to used the stream. nStyle can be one or more styles combined using the bitwise OR (|) operator.
encodingEncodingEncoder used to read/write characters.

Returns: Boolean. bOk

Instance memberWrite(str, length)

Writes a string to an open file.

ParameterTypeDescription
strSalStringThe string to write to hFile.
lengthInt32The number of bytes to write.

Returns: SalNumber.

Instance memberWrite(binary, length)

Writes a binary buffer to an open file.

ParameterTypeDescription
binarySalBinaryThe string to write to hFile.
lengthInt32The number of bytes to write.

Returns: SalNumber.

Used By

NameDescription
Sal.WindowHandleToNumberConverts a SalFileHandle to a number.
Sal.FileGetChar
Sal.FileGetStr
Sal.FilePutCharWrites a character to an open file.
Sal.FilePutStrWrites a string to an open file and appends a carriage return/line feed character to the string.
Sal.FileRead
Sal.FileSeekPositions the file pointer in an open file.
Sal.FileTellReturns the current position in an open file.
Sal.FileWriteWrites a string to an open file.
SalFileHandle.FromHandleReturns the SalFileHandle object from the handle
Vis.FileClose
Vis.FileRead
Vis.FileReadString
Vis.FileSeek
Vis.FileTell
Vis.FileWrite
Vis.FileWriteString
XSal.GZipPutChar