RFile64 Class Reference

class RFile64 : public RFile

Creates and opens a file, and performs all operations on a single open file.

This is equivalent to RFile class. This class is meant for accessing files of size greater than or equal to 2GB also.

These include:

  • reading from and writing to the file

  • seeking to a position within the file

  • locking and unlocking within the file

  • setting file attributes

Before using any of these services, a connection to a file server session must have been made, and the file must be open.

Opening Files:

  • use Open() to open an existing file for reading or writing; an error is returned if it does not already exist. To open an existing file for reading only, use Open() with an access mode of EFileRead, and a share mode of EFileShareReadersOnly.

  • use Create() to create and open a new file for writing; an error is returned if it already exists.

  • use Replace() to open a file for writing, replacing any existing file of the same name if one exists, or creating a new file if one does not exist. Note that if a file exists, its length is reset to zero.

  • use Temp() to create and open a temporary file with a unique name, for writing and reading.

When opening a file, you must specify the file server session to use for operations with that file. If you do not close the file explicitly, it is closed when the server session associated with it is closed.

Reading and Writing:

There are several variants of both Read() and Write() . The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented by variants allowing the descriptor length to be overridden, or the seek position of the first byte to be specified, or asynchronous completion, or any combination.

Reading transfers data from a file to a descriptor, and writing transfers data from a descriptor to a file. In all cases, the file data is treated as binary and byte descriptors are used ( TDes8 , TDesC8 ).

RFile

Inherits from

Public Member Functions
EFSRV_IMPORT_C TInt AdoptFromClient (const RMessage2 &, TInt , TInt )
EFSRV_IMPORT_C TInt AdoptFromCreator ( TInt , TInt )
EFSRV_IMPORT_C TInt AdoptFromServer ( TInt , TInt )
EFSRV_IMPORT_C TInt Create ( RFs &, const TDesC &, TUint )
EFSRV_IMPORT_C TInt Lock ( TInt64 , TInt64 )
EFSRV_IMPORT_C TInt Open ( RFs &, const TDesC &, TUint )
TInt Read ( TDes8 &)
void Read ( TDes8 &, TRequestStatus &)
TInt Read ( TDes8 &, TInt )
void Read ( TDes8 &, TInt , TRequestStatus &)
EFSRV_IMPORT_C TInt Read ( TInt64 , TDes8 &)
EFSRV_IMPORT_C void Read ( TInt64 , TDes8 &, TRequestStatus &)
EFSRV_IMPORT_C TInt Read ( TInt64 , TDes8 &, TInt )
EFSRV_IMPORT_C void Read ( TInt64 , TDes8 &, TInt , TRequestStatus &)
EFSRV_IMPORT_C TInt Read ( TUint , TDes8 &)
EFSRV_IMPORT_C void Read ( TUint , TDes8 &, TRequestStatus &)
EFSRV_IMPORT_C TInt Read ( TUint , TDes8 &, TInt )
EFSRV_IMPORT_C void Read ( TUint , TDes8 &, TInt , TRequestStatus &)
TInt Read ( TInt , TDes8 &)
void Read ( TInt , TDes8 &, TRequestStatus &)
TInt Read ( TInt , TDes8 &, TInt )
void Read ( TInt , TDes8 &, TInt , TRequestStatus &)
EFSRV_IMPORT_C TInt Replace ( RFs &, const TDesC &, TUint )
EFSRV_IMPORT_C TInt Seek ( TSeek , TInt64 &)
EFSRV_IMPORT_C TInt SetSize ( TInt64 )
EFSRV_IMPORT_C TInt Size ( TInt64 &)
EFSRV_IMPORT_C TInt Temp ( RFs &, const TDesC &, TFileName &, TUint )
EFSRV_IMPORT_C TInt UnLock ( TInt64 , TInt64 )
TInt Write (const TDesC8 &)
void Write (const TDesC8 &, TRequestStatus &)
TInt Write (const TDesC8 &, TInt )
void Write (const TDesC8 &, TInt , TRequestStatus &)
EFSRV_IMPORT_C TInt Write ( TInt64 , const TDesC8 &)
EFSRV_IMPORT_C void Write ( TInt64 , const TDesC8 &, TRequestStatus &)
EFSRV_IMPORT_C TInt Write ( TInt64 , const TDesC8 &, TInt )
EFSRV_IMPORT_C void Write ( TInt64 , const TDesC8 &, TInt , TRequestStatus &)
EFSRV_IMPORT_C TInt Write ( TUint , const TDesC8 &)
EFSRV_IMPORT_C void Write ( TUint , const TDesC8 &, TRequestStatus &)
EFSRV_IMPORT_C TInt Write ( TUint , const TDesC8 &, TInt )
EFSRV_IMPORT_C void Write ( TUint , const TDesC8 &, TInt , TRequestStatus &)
TInt Write ( TInt , const TDesC8 &)
void Write ( TInt , const TDesC8 &, TRequestStatus &)
TInt Write ( TInt , const TDesC8 &, TInt )
void Write ( TInt , const TDesC8 &, TInt , TRequestStatus &)
Private Member Functions
TInt Seek ( TSeek , TInt &)
TInt Size ( TInt &)
Inherited Functions
RFile::Adopt(RFs &,TInt)
RFile::Att(TUint &)const
RFile::BlockMap(SBlockMapInfo &,TInt64 &,TInt64,TInt)const
RFile::ChangeMode(TFileMode)
RFile::Clamp(RFileClamp &)
RFile::Close()
RFile::CloseSubSession(TInt)
RFile::CreateSubSession(const RSessionBase &,TInt,const TIpcArgs &)
RFile::Drive(TInt &,TDriveInfo &)const
RFile::Duplicate(const RFile &,TOwnerType)
RFile::DuplicateHandle(TInt &)const
RFile::Flush()
RFile::Flush(TRequestStatus &)
RFile::FullName(TDes &)const
RFile::Lock(TInt,TInt)const
RFile::Modified(TTime &)const
RFile::Name(TDes &)const
RFile::ReadCancel()const
RFile::ReadCancel(TRequestStatus &)const
RFile::Rename(const TDesC &)
RFile::SendReceive(TInt,const TIpcArgs &)const
RFile::Set(const TTime &,TUint,TUint)
RFile::SetAtt(TUint,TUint)
RFile::SetModified(const TTime &)
RFile::SetSize(TInt)
RFile::TransferToClient(const RMessage2 &,TInt)const
RFile::TransferToProcess(RProcess &,TInt,TInt)const
RFile::TransferToServer(TIpcArgs &,TInt,TInt)const
RFile::UnLock(TInt,TInt)const
RSubSessionBase::CreateAutoCloseSubSession(RSessionBase &,TInt,const TIpcArgs &)
RSubSessionBase::CreateSubSession(const RSessionBase &,TInt)
RSubSessionBase::RSubSessionBase()
RSubSessionBase::Send(TInt)const
RSubSessionBase::Send(TInt,const TIpcArgs &)const
RSubSessionBase::SendReceive(TInt)const
RSubSessionBase::SendReceive(TInt,TRequestStatus &)const
RSubSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSubSessionBase::Session()const
RSubSessionBase::SubSessionHandle()const

Member Functions Documentation

AdoptFromClient(const RMessage2 &, TInt, TInt)

EFSRV_IMPORT_C TInt AdoptFromClient ( const RMessage2 & aMsg,
TInt aFsHandleIndex,
TInt aFileHandleIndex
)

Allows a server to adopt an already open file from a client. The client's RFs and RFile handles are contained in message slots within aMsg.

Assumes that the client's RFs and RFile handles have been sent to the server using TransferToServer() .

This RFile will own it's RFs session so that when the sub-session ( RFile ) is closed so will the RFs session.

Parameters

const RMessage2 & aMsg The message received from the client
TInt aFsHandleIndex The index that identifies the message slot of a file server session (RFs) handle
TInt aFileHandleIndex The index that identifies the message slot of the sub-session (RFile) handle of the already opened file

AdoptFromCreator(TInt, TInt)

EFSRV_IMPORT_C TInt AdoptFromCreator ( TInt aFsIndex,
TInt aFileHandleIndex
)

Allows a server to adopt an already open file from a client process. The client's file-server ( RFs ) and file ( RFile ) handles are contained in this process's environment data slots.

Assumes that the client's RFs and RFile handles have been sent to the server process using TransferToProcess() .

This RFile will own it's RFs session so that when the sub-session ( RFile ) is closed so will the RFs session.

Parameters

TInt aFsIndex An index that identifies the slot in the process environment data that contains the file server session (RFs) handle
TInt aFileHandleIndex An index that identifies the slot in the process environment data that contains the sub-session (RFile) handle of the already opened file

AdoptFromServer(TInt, TInt)

EFSRV_IMPORT_C TInt AdoptFromServer ( TInt aFsHandle,
TInt aFileHandle
)

Allows a client to adopt an already open file from a server.

Assumes that the server's RFs and RFile handles have been sent to the client using TransferToClient() .

This RFile will own it's RFs session so that when the sub-session ( RFile ) is closed so will the RFs session.

Parameters

TInt aFsHandle The file server session (RFs) handle
TInt aFileHandle The file (RFile) handle of the already opened file

Create(RFs &, const TDesC &, TUint)

EFSRV_IMPORT_C TInt Create ( RFs & aFs,
const TDesC & aName,
TUint aFileMode
)

Creates and opens a new file for writing.

If the file already exists, an error is returned.

If the resulting path does not exist, then the operation cannot proceed and the function returns an error code.

Notes:

1. To close the file, use Close()

2. It automatically sets the file's archive attribute.

TFileMode
capability
Dependent If the path in aName starts with /Sys then capability Tcb is required
capability
Dependent If the path in aName starts with /Resource then capability Tcb is required
capability
Dependent If the path in aName starts with /Private and does not match this process' SID then AllFiles capability is required.

Parameters

RFs & aFs The file server session.
const TDesC & aName The name of the file. Any path components (i.e. drive letter or directory), which are not specified, are taken from the session path. The file name shall not contain wild cards ('?' or '*' characters) and illegal characters like '<', '>', ':', '"', '/', '|' and ''. Backslash '\' character is allowed only as a path delimiter. The filename containing only white space characters (See TChar::IsSpace()) is also illegal.
TUint aFileMode The mode in which the file is opened. The access mode is automatically set to EFileWrite. See TFileMode.

Lock(TInt64, TInt64)

EFSRV_IMPORT_C TInt Lock ( TInt64 aPos,
TInt64 aLength
) const

Parameters

TInt64 aPos
TInt64 aLength

Open(RFs &, const TDesC &, TUint)

EFSRV_IMPORT_C TInt Open ( RFs & aFs,
const TDesC & aName,
TUint aFileMode
)

Opens an existing file for reading or writing.

If the file does not already exist, an error is returned.

Notes:

1. To close the file, use Close()

2. Attempting to open a file with the read-only attribute using the EFileWrite access mode results in an error.

3. Attempting to open a file which is greater than or equal to 2GByte (2,147,483,648 bytes) will fail with KErrTooBig

4. After a file has been opened, the current write position is set to the start of the file. If necessary, use RFile::Seek() to move to a different position within the file.

TFileMode
capability
Dependent If the path for aName is /Sys and aMode is neither EFileShareReadersOnly nor EFileRead then Tcb capability is required.
capability
Dependent If the path for aName is /Sys and aMode is either EFileShareReadersOnly or EFileRead then Allfiles capability is required.
capability
Dependent If the path for aName begins with /Private and does not match this process' SID then AllFiles capability is required.
capability
Dependent If the path for aName begins with /Resource and aMode is neither EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly nor EFileRead then Tcb capability is required.

Parameters

RFs & aFs The file server session.
const TDesC & aName The name of the file. Any path components (i.e. drive letter or directory), which are not specified, are taken from the session path.The file name shall not contain wild cards ('?' or '*' characters) and illegal characters like '<', '>', ':', '"', '/', '|' and ''. Backslash '\' character is allowed only as a path delimiter. The filename containing only white space characters (See TChar::IsSpace()) is also illegal.
TUint aFileMode The mode in which the file is opened. See TFileMode.

Read(TDes8 &)

TInt Read ( TDes8 & aDes ) const [inline]

Reads from the file at the current position.

This is a synchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file,the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero.

TDesC8::Length

Parameters

TDes8 & aDes Descriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.

Read(TDes8 &, TRequestStatus &)

void Read ( TDes8 & aDes,
TRequestStatus & aStatus
) const [inline]

Reads from the file at the current position.

This is an asynchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file,the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero.

TDesC8::Length

Parameters

TDes8 & aDes Descriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TRequestStatus & aStatus Request status. On completion contains: KErrNone, if successful, otherwise one of the other system-wide error codes.

Read(TDes8 &, TInt)

TInt Read ( TDes8 & aDes,
TInt aLength
) const [inline]

Reads the specified number of bytes of binary data from the file at the current position.

This is a synchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file,the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero. Assuming aLength is less than the maximum length of the descriptor, the only circumstance in which Read() can return fewer bytes than requested, is when the end of file is reached or if an error occurs.

Parameters

TDes8 & aDes Descriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.
TInt aLength The number of bytes to be read from the file into the descriptor. If an attempt is made to read more bytes than the descriptor's maximum length, the function returns KErrOverflow. This value must not be negative, otherwise the function returns KErrArgument.

Read(TDes8 &, TInt, TRequestStatus &)

void Read ( TDes8 & aDes,
TInt aLength,
TRequestStatus & aStatus
) const [inline]

Reads a specified number of bytes of binary data from the file at the current position.

This is an asynchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file, the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero. Assuming aLength is less than the maximum length of the descriptor, the only circumstances in which Read() can return fewer bytes than requested is when the end of file is reached or if an error has occurred.

Parameters

TDes8 & aDes Descriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TInt aLength The number of bytes to be read from the file into the descriptor. If an attempt is made to read more bytes than the descriptor's maximum length, then the function updates aStatus parameter with KErrOverflow. It must not be negative otherwise the function updates aStatus with KErrArgument.
TRequestStatus & aStatus Request status. On completion contains KErrNone if successful, otherwise one of the other system-wide error codes.

Read(TInt64, TDes8 &)

EFSRV_IMPORT_C TInt Read ( TInt64 aPos,
TDes8 & aDes
) const

Parameters

TInt64 aPos
TDes8 & aDes

Read(TInt64, TDes8 &, TRequestStatus &)

EFSRV_IMPORT_C void Read ( TInt64 aPos,
TDes8 & aDes,
TRequestStatus & aStatus
) const

Parameters

TInt64 aPos
TDes8 & aDes
TRequestStatus & aStatus

Read(TInt64, TDes8 &, TInt)

EFSRV_IMPORT_C TInt Read ( TInt64 aPos,
TDes8 & aDes,
TInt aLength
) const

Parameters

TInt64 aPos
TDes8 & aDes
TInt aLength

Read(TInt64, TDes8 &, TInt, TRequestStatus &)

EFSRV_IMPORT_C void Read ( TInt64 aPos,
TDes8 & aDes,
TInt aLength,
TRequestStatus & aStatus
) const

Parameters

TInt64 aPos
TDes8 & aDes
TInt aLength
TRequestStatus & aStatus

Read(TUint, TDes8 &)

EFSRV_IMPORT_C TInt Read ( TUint aPos,
TDes8 & aDes
) const

Parameters

TUint aPos
TDes8 & aDes

Read(TUint, TDes8 &, TRequestStatus &)

EFSRV_IMPORT_C void Read ( TUint aPos,
TDes8 & aDes,
TRequestStatus & aStatus
) const

Parameters

TUint aPos
TDes8 & aDes
TRequestStatus & aStatus

Read(TUint, TDes8 &, TInt)

EFSRV_IMPORT_C TInt Read ( TUint aPos,
TDes8 & aDes,
TInt aLength
) const

Parameters

TUint aPos
TDes8 & aDes
TInt aLength

Read(TUint, TDes8 &, TInt, TRequestStatus &)

EFSRV_IMPORT_C void Read ( TUint aPos,
TDes8 & aDes,
TInt aLength,
TRequestStatus & aStatus
) const

Parameters

TUint aPos
TDes8 & aDes
TInt aLength
TRequestStatus & aStatus

Read(TInt, TDes8 &)

TInt Read ( TInt aPos,
TDes8 & aDes
) const [inline]

Reads from the file at the specified offset within the file

This is a synchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file, the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero.

Note: 1. This function over-rides the base class function RFile::Read and inlines the base class RFile::Read . 2. The difference is that this function can read beyond 2GB - 1 when aPos + length of aDes is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of TInt RFile64::Read(TInt64 aPos,TDes8& aDes) const is recommended.

Parameters

TInt aPos Position of first byte to be read. This is an offset from the start of the file. If no position is specified, reading begins at the current file position. If aPos is beyond the end of the file, the function returns a zero length descriptor.
TDes8 & aDes The descriptor into which binary data is read. Any existing content is overwritten. On return, its length is set to the number of bytes read.

Read(TInt, TDes8 &, TRequestStatus &)

void Read ( TInt aPos,
TDes8 & aDes,
TRequestStatus & aStatus
) const [inline]

Reads from the file at the specified offset within the file.

This is an asynchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file, the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero.

Note: 1. This function over-rides the base class function RFile::Read and inlines the base class RFile::Read . 2. The difference is that this function can read beyond 2GB - 1 when aPos + length of aDes is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of void RFile64::Read(TInt64 aPos,TDes8& aDes,TRequestStatus& aStatus) const is recommended.

Parameters

TInt aPos Position of first byte to be read. This is an offset from the start of the file. If no position is specified, reading begins at the current file position. If aPos is beyond the end of the file, the function returns a zero length descriptor.
TDes8 & aDes The descriptor into which binary data is read. Any existing content is overwritten. On return, its length is set to the number of bytes read. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TRequestStatus & aStatus The request status. On completion, contains an error code of KErrNone if successful, otherwise one of the other system-wide error codes.

Read(TInt, TDes8 &, TInt)

TInt Read ( TInt aPos,
TDes8 & aDes,
TInt aLength
) const [inline]

Reads the specified number of bytes of binary data from the file at a specified offset within the file.

This is a synchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file, the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero. Assuming aLength is less than the maximum length of the descriptor, the only circumstances in which Read() can return fewer bytes than requested is when the end of file is reached or if an error has occurred.

Note: 1. This function over-rides the base class function RFile::Read and inlines the base class RFile::Read . 2. The difference is that this function can read beyond 2GB - 1 when aPos + aLength is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of TInt RFile64::Read(TInt64 aPos,TDes8& aDes,TInt aLength) const is recommended.

Parameters

TInt aPos Position of first byte to be read. This is an offset from the start of the file. If no position is specified, reading begins at the current file position. If aPos is beyond the end of the file, the function returns a zero length descriptor.
TDes8 & aDes The descriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read.
TInt aLength The number of bytes to read from the file into the descriptor. If an attempt is made to read more bytes than the descriptor's maximum length, then the function updates aStatus parameter with KErrOverflow. It must not be negative otherwise the function updates aStatus with KErrArgument.

Read(TInt, TDes8 &, TInt, TRequestStatus &)

void Read ( TInt aPos,
TDes8 & aDes,
TInt aLength,
TRequestStatus & aStatus
) const [inline]

Reads the specified number of bytes of binary data from the file at a specified offset within the file.

This is an asynchronous function.

Note that when an attempt is made to read beyond the end of the file, no error is returned. The descriptor's length is set to the number of bytes read into it. Therefore, when reading through a file, the end of file has been reached when the descriptor length, as returned by TDesC8::Length() , is zero. Assuming aLength is less than the maximum length of the descriptor, the only circumstances in which Read() can return fewer bytes than requested is when the end of file is reached or if an error has occurred.

Note: 1. This function over-rides the base class function RFile::Read and inlines the base class RFile::Read . 2. The difference is that this function can read beyond 2GB - 1 when aPos + aLength is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of void RFile64::Read(TInt64 aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const is recommended.

Parameters

TInt aPos Position of first byte to be read. This is an offset from the start of the file. If no position is specified, reading begins at the current file position. If aPos is beyond the end of the file, the function returns a zero length descriptor.
TDes8 & aDes The descriptor into which binary data is read. Any existing contents are overwritten. On return, its length is set to the number of bytes read. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TInt aLength The number of bytes to read from the file into the descriptor. If an attempt is made to read more bytes than the descriptor's maximum length, then the function returns KErrOverflow. It must not be negative otherwise the function returns KErrArgument.
TRequestStatus & aStatus Request status. On completion contains KErrNone if successful, otherwise one of the other system-wide error codes.

Replace(RFs &, const TDesC &, TUint)

EFSRV_IMPORT_C TInt Replace ( RFs & aFs,
const TDesC & aName,
TUint aFileMode
)

Opens a file for writing, replacing the content of any existing file of the same name if it exists, or creating a new file if it does not exist.

If the resulting path exists, then:

  • the length of an existing file with the same filename is re-set to zero

  • a new file is created, if no existing file with the same filename can be found.

If the resulting path does not exist, then the operation cannot proceed and the function returns an error code.

Notes:

  • To close the file, use Close() , defined in the base class RFsBase.

  • It automatically sets the file's archive attribute.

TFileMode
capability
Dependent If the path in aName starts with /Sys then capability Tcb is required
capability
Dependent If the path in aName starts with /Resource then capability Tcb is required
capability
Dependent If the path in aName starts with /Private and does not match this process' SID then AllFiles capability is required.

Parameters

RFs & aFs The file server session.
const TDesC & aName The name of the file. Any path components (i.e. drive letter or directory), which are not specified, are taken from the session path. The file name shall not contain wild cards ('?' or '*' characters) and illegal characters like '<', '>', ':', '"', '/', '|' and ''. Backslash '\' character is allowed only as a path delimiter. The filename containing only white space characters (See TChar::IsSpace()) is also illegal.
TUint aFileMode The mode in which the file is opened. The access mode is automatically set to EFileWrite. See TFileMode.

Seek(TSeek, TInt64 &)

EFSRV_IMPORT_C TInt Seek ( TSeek aMode,
TInt64 & aPos
) const

Parameters

TSeek aMode
TInt64 & aPos

Seek(TSeek, TInt &)

TInt Seek ( TSeek aMode,
TInt & aPos
) const [private]

Sets the the current file position.

The function can also be used to get the current file position without changing it. The file position is the position at which reading and writing takes place. The start of the file is position zero.

To retrieve the current file position without changing it, specify ESeekCurrent for the seek mode, and zero for the offset.

If the seek mode is ESeekStart, then:

1. the function does not modify the aPos argument,

2. the function returns an error if the offset specified is negative.

If the seek mode is ESeekAddress, an error is returned if:

1. the file is not in ROM,

2. the offset specified is greater than the size of the file.

Parameters

TSeek aMode Seek mode. Controls the destination of the seek operation.
TInt & aPos Offset from location specified in aMode. Can be negative. On return contains the new file position. If the seek mode is either ESeekCurrent or ESeekEnd and the offset specifies a position before the start of the file or beyond the end of the file, then on return, aPos is set to the new file position (either the start or the end of the file). If the seek mode is ESeekAddress, aPos returns the address of the byte at the specified offset within the file.

SetSize(TInt64)

EFSRV_IMPORT_C TInt SetSize ( TInt64 aSize )

Parameters

TInt64 aSize

Size(TInt64 &)

EFSRV_IMPORT_C TInt Size ( TInt64 & aSize ) const

Parameters

TInt64 & aSize

Size(TInt &)

TInt Size ( TInt & aSize ) const [private]

Gets the current file size.

Parameters

TInt & aSize On return, the size of the file in bytes.

Temp(RFs &, const TDesC &, TFileName &, TUint)

EFSRV_IMPORT_C TInt Temp ( RFs & aFs,
const TDesC & aPath,
TFileName & aName,
TUint aFileMode
)

Creates and opens a temporary file with a unique name for writing and reading.

Notes:

1. To close the file, use Close()

TFileMode
capability
Dependent If aPath starts with /Sys then capability Tcb is required
capability
Dependent If aPath starts with /Resource then capability Tcb is required
capability
Dependent If aPath starts with /Private and does not match this process' SID then AllFiles capability is required.

Parameters

RFs & aFs The file server session.
const TDesC & aPath The directory in which the file is created.
TFileName & aName On return, contains the full path and file name of the file. The filename is guaranteed to be unique within the directory specified by aPath.
TUint aFileMode The mode in which the file is opened. The access mode is automatically set to EFileWrite. See TFileMode.

UnLock(TInt64, TInt64)

EFSRV_IMPORT_C TInt UnLock ( TInt64 aPos,
TInt64 aLength
) const

Parameters

TInt64 aPos
TInt64 aLength

Write(const TDesC8 &)

TInt Write ( const TDesC8 & aDes ) [inline]

Writes to the file at the current offset within the file.

This is a synchronous function.

Parameters

const TDesC8 & aDes The descriptor from which binary data is written. The function writes the entire contents of aDes to the file.

Write(const TDesC8 &, TRequestStatus &)

void Write ( const TDesC8 & aDes,
TRequestStatus & aStatus
) [inline]

Writes to the file at the current offset within the file.

This is an asynchronous function.

Parameters

const TDesC8 & aDes The descriptor from which binary data is written. The function writes the entire contents of aDes to the file. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TRequestStatus & aStatus Request status. On completion contains KErrNone if successful, otherwise one of the other system-wide error codes.

Write(const TDesC8 &, TInt)

TInt Write ( const TDesC8 & aDes,
TInt aLength
) [inline]

Writes a portion of a descriptor to the file at the current offset within the file.

This is a synchronous function.

panic
FSCLIENT 27 in debug mode, if aLength is greater than the length of the descriptor aDes.

Parameters

const TDesC8 & aDes The descriptor from which binary data is written.
TInt aLength The number of bytes to be written from the descriptor. This must not be greater than the length of the descriptor. It must not be negative.

Write(const TDesC8 &, TInt, TRequestStatus &)

void Write ( const TDesC8 & aDes,
TInt aLength,
TRequestStatus & aStatus
) [inline]

Writes a portion of a descriptor to the file at the current offset within the file.

This is an asynchronous function.

Parameters

const TDesC8 & aDes The descriptor from which binary data is written. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TInt aLength The number of bytes to be written from the descriptor. This must not be greater than the length of the descriptor. It must not be negative.
TRequestStatus & aStatus Request status. On completion contains KErrNone if successful; KErrArgument if aLength is negative; otherwise one of the other system-wide error codes.

Write(TInt64, const TDesC8 &)

EFSRV_IMPORT_C TInt Write ( TInt64 aPos,
const TDesC8 & aDes
)

Parameters

TInt64 aPos
const TDesC8 & aDes

Write(TInt64, const TDesC8 &, TRequestStatus &)

EFSRV_IMPORT_C void Write ( TInt64 aPos,
const TDesC8 & aDes,
TRequestStatus & aStatus
)

Parameters

TInt64 aPos
const TDesC8 & aDes
TRequestStatus & aStatus

Write(TInt64, const TDesC8 &, TInt)

EFSRV_IMPORT_C TInt Write ( TInt64 aPos,
const TDesC8 & aDes,
TInt aLength
)

Parameters

TInt64 aPos
const TDesC8 & aDes
TInt aLength

Write(TInt64, const TDesC8 &, TInt, TRequestStatus &)

EFSRV_IMPORT_C void Write ( TInt64 aPos,
const TDesC8 & aDes,
TInt aLength,
TRequestStatus & aStatus
)

Parameters

TInt64 aPos
const TDesC8 & aDes
TInt aLength
TRequestStatus & aStatus

Write(TUint, const TDesC8 &)

EFSRV_IMPORT_C TInt Write ( TUint aPos,
const TDesC8 & aDes
)

Parameters

TUint aPos
const TDesC8 & aDes

Write(TUint, const TDesC8 &, TRequestStatus &)

EFSRV_IMPORT_C void Write ( TUint aPos,
const TDesC8 & aDes,
TRequestStatus & aStatus
)

Parameters

TUint aPos
const TDesC8 & aDes
TRequestStatus & aStatus

Write(TUint, const TDesC8 &, TInt)

EFSRV_IMPORT_C TInt Write ( TUint aPos,
const TDesC8 & aDes,
TInt aLength
)

Parameters

TUint aPos
const TDesC8 & aDes
TInt aLength

Write(TUint, const TDesC8 &, TInt, TRequestStatus &)

EFSRV_IMPORT_C void Write ( TUint aPos,
const TDesC8 & aDes,
TInt aLength,
TRequestStatus & aStatus
)

Parameters

TUint aPos
const TDesC8 & aDes
TInt aLength
TRequestStatus & aStatus

Write(TInt, const TDesC8 &)

TInt Write ( TInt aPos,
const TDesC8 & aDes
) [inline]

Writes to the file at the specified offset within the file

This is a synchronous function.

Note: 1. This function over-rides the base class function RFile::Write and inlines the base class RFile::Write . 2. The difference is that this function can write beyond 2GB - 1 when aPos + length of aDes is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of TInt RFile64::Write(TInt64 aPos,const TDesC8& aDes) is recommended.

Parameters

TInt aPos The offset from the start of the file at which the first byte is written. If a position beyond the end of the file is specified, then the write operation begins at the end of the file. If the position has been locked, then the write fails.
const TDesC8 & aDes The descriptor from which binary data is written. The function writes the entire contents of aDes to the file.

Write(TInt, const TDesC8 &, TRequestStatus &)

void Write ( TInt aPos,
const TDesC8 & aDes,
TRequestStatus & aStatus
) [inline]

Writes to the file at the specified offset within the file

This is an asynchronous function.

Note: 1. This function over-rides the base class function RFile::Write and inlines the base class RFile::Write . 2. The difference is that this function can write beyond 2GB - 1 when aPos + length of aDes is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of void RFile64::Write(TInt64 aPos,const TDesC8& aDes,TRequestStatus& aStatus) is recommended.

Parameters

TInt aPos The offset from the start of the file at which the first byte is written. If a position beyond the end of the file is specified, then the write operation begins at the end of the file. If the position has been locked, then the write fails.
const TDesC8 & aDes The descriptor from which binary data is written. The function writes the entire contents of aDes to the file. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TRequestStatus & aStatus Request status. On completion contains KErrNone if successful, otherwise one of the other system-wide error codes.

Write(TInt, const TDesC8 &, TInt)

TInt Write ( TInt aPos,
const TDesC8 & aDes,
TInt aLength
) [inline]

Writes the specified number of bytes to the file at the specified offset within the file.

This is a synchronous function.

Note: 1. This function over-rides the base class function RFile::Write and inlines the base class RFile::Write . 2. The difference is that this function can write beyond 2GB - 1 when aPos + aLength is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of TInt RFile64::Write(TInt64 aPos,const TDesC8& aDes,TInt aLength) is recommended.

Parameters

TInt aPos The offset from the start of the file at which the first byte is written. If a position beyond the end of the file is specified, then the write operation begins at the end of the file. If the position has been locked, then the write fails.
const TDesC8 & aDes The descriptor from which binary data is written.
TInt aLength The number of bytes to be written from aDes . It must not be negative.

Write(TInt, const TDesC8 &, TInt, TRequestStatus &)

void Write ( TInt aPos,
const TDesC8 & aDes,
TInt aLength,
TRequestStatus & aStatus
) [inline]

Writes the specified number of bytes to the file at the specified offset within the file.

This is an asynchronous function.

Note: 1. This function over-rides the base class function RFile::Write and inlines the base class RFile::Write . 2. The difference is that this function can write beyond 2GB - 1 when aPos + aLength is beyond 2GB - 1. 3. This function is protected using _F32_STRICT_64_BIT_MIGRATION macro to help migration to 64 bit file addressing. When the macro is defined, this function becomes a private overload and hence use of void RFile64::Write(TInt64 aPos,const TDesC8& aDes,TRequestStatus& aStatus) is recommended.

Parameters

TInt aPos The offset from the start of the file at which the first byte is written. If a position beyond the end of the file is specified, then the write operation begins at the end of the file. If the position has been locked, then the write fails.
const TDesC8 & aDes The descriptor from which binary data is written. NB: this function is asynchronous and the request that it represents may not complete until some time after the call to the function has returned. It is important, therefore, that this descriptor remain valid, or remain in scope, until you have been notified that the request is complete.
TInt aLength The number of bytes to be written from aDes. It must not be negative.
TRequestStatus & aStatus Request status. On completion contains KErrNone if successful; KErrArgument if aLength is negative; otherwise one of the other system-wide error codes.