class PTextFile: public PFile

A class representing a a structured file that is portable accross CPU architectures.

Inheritance:


Public

[more] Construction
[more] Line I/O functions


Inherited from PFile:

Public

Overrides from class PObject

Overrides from class PChannel

File manipulation functions

File channel functions

Protected Fields

oPFilePath path
oBOOL removeOnClose


Inherited from PChannel:

Public Methods

ostatic BOOL ConvertOSError( int libcReturnValue, Errors & lastError, int & osError )

Public

Information functions

Reading functions

Writing functions

Miscellaneous functions

Error functions

Protected Fields

oint os_handle
oErrors lastErrorCode[NumErrorGroups+1]
oint lastErrorNumber[NumErrorGroups+1]
oPINDEX lastReadCount
oPINDEX lastWriteCount
oPTimeInterval readTimeout
oPTimeInterval writeTimeout

Protected Methods

ovirtual BOOL ConvertOSError( int libcReturnValue, ErrorGroup group = LastGeneralError )
oBOOL SetErrorValues( Errors errorCode, int osError, ErrorGroup group = LastGeneralError )
oint ReadCharWithTimeout( PTimeInterval & timeout )


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions


Documentation

A class representing a a structured file that is portable accross CPU architectures. Essentially this will normalise the end of line character which differs fromplatform to platform.
o Construction

o PTextFile()
Create a text file object but do not open it. It does not initially have a valid file name. However, an attempt to open the file using the PFile::Open() function will generate a unique temporary file.

o PTextFile( OpenMode mode, int opts = ModeDefault )
Create a unique temporary file name, and open the file in the specified mode and using the specified options. Note that opening a new, unique, temporary file name in ReadOnly mode will always fail. This would only be usefull in a mode and options that will create the file.

The PChannel::IsOpen() function may be used after object construction to determine if the file was successfully opened.

Parameters:
mode - Mode in which to open the file.
opts - OpenOptions enum for open operation.

o PTextFile( const PFilePath & name, OpenMode mode = ReadWrite, int opts = ModeDefault )
Create a text file object with the specified name and open it in the specified mode and with the specified options.

The PChannel::IsOpen() function may be used after object construction to determine if the file was successfully opened.

Parameters:
name - Name of file to open.
mode - Mode in which to open the file.
opts - OpenOptions enum for open operation.

o Line I/O functions

oBOOL ReadLine( PString & str )
Read a line from the text file. What constitutes an end of line in the file is platform dependent.

Use the PChannel::GetLastError() function to determine if there was some error other than end of file.

Returns:
TRUE if successful, FALSE if at end of file or a read error.
Parameters:
str - String into which line of text is read.

oBOOL WriteLine( const PString & str )
Read a line from the text file. What constitutes an end of line in the file is platform dependent.

Use the PChannel::GetLastError() function to determine the failure mode.

Returns:
TRUE if successful, FALSE if an error occurred.
Parameters:
str - String to write with end of line terminator.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.