diff -r 48780e181b38 -r 578be2adaf3e Symbian3/PDK/Source/GUID-D71D0091-5C4E-5B2F-B1B6-783F11AB5021.dita --- a/Symbian3/PDK/Source/GUID-D71D0091-5C4E-5B2F-B1B6-783F11AB5021.dita Tue Jul 20 12:00:49 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-D71D0091-5C4E-5B2F-B1B6-783F11AB5021.dita Fri Aug 13 16:47:46 2010 +0100 @@ -1,119 +1,119 @@ - - - - - -Writing -to Large Files How to write to large files. -
Write() from relative/current position

There are -four RFile::Write() overloaded functions relative/current -position that allow you to specify a position greater than 2GB–1 by using -the TInt64 parameter.

    -
  • RFile64::Write(const -TDesC8& aDes)

  • -
  • RFile64::Write(const -TDesC8& aDes, TRequestStatus& aStatus)

  • -
  • RFile64::Write(const -TDesC8& aDes, TInt aLength)

  • -
  • RFile64::Write(const -TDesC8& aDes, TInt aLength, TRequestStatus& aStatus).

  • -

The migration procedure is as follows:

    -
  1. Use RFile64 instead -of RFile.

    // RFile file; -RFile64 file;

  2. -
  3. Use TInt64 variables -in place of the TInt variables representing the number -of bytes written.

    // Tint bytesWritten = 0; -Tint64 bytesWritten = 0;

  4. -

Example

The -example below shows an application writing to locations greater than 2GB–1. -The RFile class has been replaced with RFile64 and -the TInt variable that represents the number of bytes written -has been changed to TInt64.

// RFile file; - RFile64 file; - TInt err = file.Open(TheFs, _L(“BIGFILE.BIG”), EFileWrite); - if(err != KErrNone) - { - // unrelated error - return err; - } - - // Tint bytesWritten = 0; - Tint64 bytesWritten = 0; - TBuf8<1024> writeBuf; - ... - - FOREVER - { - // Fill buffer with input data - r = prepareBuffer(writeBuf); - if(KErrNone != r) - { - // No data to write! - break; - } - - r = file.Write(writeBuf); - if(r != KErrNone) - { - // Error handling - } - bytesWritten += writeBuf.Length(); - }
-
Write() from absolute position

There are four RFile::Write() overloaded -functions that allow you to specify an absolute position greater than 2GB–1 -by using the TInt64 parameter.

    -
  • RFile64::Write(TInt64 -aPos, const TDesC8& aDes)

  • -
  • RFile64::Write(TInt64 -aPos, const TDesC8& aDes, TRequestStatus& aStatus)

  • -
  • RFile64::Write(TInt64 -aPos, const TDesC8& aDes, TInt aLength)

  • -
  • RFile64::Write(TInt64 -aPos, const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus).

  • -

The migration procedure is as follows:

    -
  1. Use a TInt64 instead -of a TInt for the write position.

    // TInt writePosition = 0; - TInt64 writePosition = 0;

  2. -
  3. Replace RFile with RFile64.

    // RFile file; - RFile64 file;

  4. -

Example

To -write to locations beyond 2GB–1 the file must be opened for 64-bit access -and TInt variables should be replaced with TInt64.

// RFile file; - RFile64 file; - TInt err = file.Open(TheFs, _L(“BIGFILE.BIG”), EFileWrite); - if(err != KErrNone) - { - // unrelated error - return err; - } - - // TInt writePosition = 0; - TInt64 writePosition = 0; // Use a TInt64 to prevent wrap-around - TBuf8<1024> writeBuf; - ... - FOREVER - { - // Fill buffer with input data - r = prepareBuffer(writeBuf); - if(KErrNone != r) - { - // No data to write! - break; - } - - r = file.Write(writePosition, writeBuf); - if(r != KErrNone) - { - // unrelated error - return r; - } - writePosition += writeBuf.Length(); // Must use a TInt64 - }
+ + + + + +Writing +to Large Files How to write to large files. +
Write() from relative/current position

There are +four RFile::Write() overloaded functions relative/current +position that allow you to specify a position greater than 2GB–1 by using +the TInt64 parameter.

    +
  • RFile64::Write(const +TDesC8& aDes)

  • +
  • RFile64::Write(const +TDesC8& aDes, TRequestStatus& aStatus)

  • +
  • RFile64::Write(const +TDesC8& aDes, TInt aLength)

  • +
  • RFile64::Write(const +TDesC8& aDes, TInt aLength, TRequestStatus& aStatus).

  • +

The migration procedure is as follows:

    +
  1. Use RFile64 instead +of RFile.

    // RFile file; +RFile64 file;

  2. +
  3. Use TInt64 variables +in place of the TInt variables representing the number +of bytes written.

    // Tint bytesWritten = 0; +Tint64 bytesWritten = 0;

  4. +

Example

The +example below shows an application writing to locations greater than 2GB–1. +The RFile class has been replaced with RFile64 and +the TInt variable that represents the number of bytes written +has been changed to TInt64.

// RFile file; + RFile64 file; + TInt err = file.Open(TheFs, _L(“BIGFILE.BIG”), EFileWrite); + if(err != KErrNone) + { + // unrelated error + return err; + } + + // Tint bytesWritten = 0; + Tint64 bytesWritten = 0; + TBuf8<1024> writeBuf; + ... + + FOREVER + { + // Fill buffer with input data + r = prepareBuffer(writeBuf); + if(KErrNone != r) + { + // No data to write! + break; + } + + r = file.Write(writeBuf); + if(r != KErrNone) + { + // Error handling + } + bytesWritten += writeBuf.Length(); + }
+
Write() from absolute position

There are four RFile::Write() overloaded +functions that allow you to specify an absolute position greater than 2GB–1 +by using the TInt64 parameter.

    +
  • RFile64::Write(TInt64 +aPos, const TDesC8& aDes)

  • +
  • RFile64::Write(TInt64 +aPos, const TDesC8& aDes, TRequestStatus& aStatus)

  • +
  • RFile64::Write(TInt64 +aPos, const TDesC8& aDes, TInt aLength)

  • +
  • RFile64::Write(TInt64 +aPos, const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus).

  • +

The migration procedure is as follows:

    +
  1. Use a TInt64 instead +of a TInt for the write position.

    // TInt writePosition = 0; + TInt64 writePosition = 0;

  2. +
  3. Replace RFile with RFile64.

    // RFile file; + RFile64 file;

  4. +

Example

To +write to locations beyond 2GB–1 the file must be opened for 64-bit access +and TInt variables should be replaced with TInt64.

// RFile file; + RFile64 file; + TInt err = file.Open(TheFs, _L(“BIGFILE.BIG”), EFileWrite); + if(err != KErrNone) + { + // unrelated error + return err; + } + + // TInt writePosition = 0; + TInt64 writePosition = 0; // Use a TInt64 to prevent wrap-around + TBuf8<1024> writeBuf; + ... + FOREVER + { + // Fill buffer with input data + r = prepareBuffer(writeBuf); + if(KErrNone != r) + { + // No data to write! + break; + } + + r = file.Write(writePosition, writeBuf); + if(r != KErrNone) + { + // unrelated error + return r; + } + writePosition += writeBuf.Length(); // Must use a TInt64 + }
\ No newline at end of file