How to open and create large files.
Both the 32-bit and the 64-bit functions can be used to open files. However, when using a 32-bit RFile handle (sub-session connection) a file cannot be increased to greater than 2GB-1.
To increase the size of a file beyond this limit, open it using the 64-bit RFile64 functions.
If a file is opened simultaneously by RFile and RFile64, using the RFile64 handle the file can be made larger than 2GB-1 (even if there is an RFile sub-session open).
RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
RFile64::AdoptFromClient(const RMessage2& aMsg, TInt aFsIndex, TInt aFileIndex)
RFile64::AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex).
The RFile64::AdoptFromXXX() functions allow a server to adopt a file that is already open from a client, a server or even from another process (creator).
The File Server enables a large file access mode for the adopter. For example, the server that obtains the file handle from its client can use RFile64, irrespective of whether the client has opened the file in large file mode or not.
Large file access is supported when using RFile64. The file can be increased to a size larger than 2GB-1 and the error KErrTooBig will not be returned when using RFile64.
This example shows the Temp() function but the same concepts apply for the others.
// RFile file; RFile64 file; TInt err; TFileName myTempFile; err = file.Temp(TheFs, _L(“D:\\Private\\”), myTempFile, EFileWrite); if(err != KErrNone) { return err; } ... err = file.Write(myDesc); If(err != KErrNone) { // handle error return err; } ...
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.