How to lock a section of a large file.
The RFile64::Lock() function has a TInt64 parameter that specifies the position to lock from. By using a TInt64 rather than a TInt, the function can lock a section of file that is greater than 2GB–1.
The example below shows a variable of the type TInt64 being used to specify the lock position and the lock length being used together with the RFile64 class.
// RFile file; RFile64 file; TInt err = file.Open(TheFs, _L(“BIGFILE.BIG”), EFileWrite); if(err != KErrNone) { // handle error return err; } // Large file access is now supported! // TInt lockPosition, lockLength; TInt64 lockPosition, lockLength; err = file.Lock(lockPosition,lockLength); if(err != KErrNone) { //could return with KErrArgument if lockPosition+lockLength>63Bytes return err; }
You must unlock the section of file using RFile64::Unlock(), as explained in Unlocking a Large File.
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.