![]() Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
![]() |
The QMemoryFile class provide means to map a file info memory or refere to a block or memory by name. More...
#include <qmemoryfile_p.h>
Warning: This class is not part of the Qt APi and subject to change. This file file may change from version to version without notice, or even be removed.
Currently this class supports read only access on all platforms; and read plus write accces provided on unix and windows based plaforms. The size of mapped file can not be changed.
The currently defined values are :
If a file is being mapped to be written to, then the flags of subsequent QMemoryFiles mapped to the same file should include QMemoryFile::Write.
Example:
// Open a maping to file text.dat QMemoryFile memoryFile("text.dat", QMemoryFile:Read, 20); char *data = memoryFile.data(); int sum = 0; for (int i = 0; i < 20; i++){ sum = sum + data[i]; } qDebug("Sum =%d", sum);
Example for creating named memory block:
QMemoryFile block1("\\\\block1", QMemoryFile::Create | QMemoryFile::Write, 20); char *dataBlock = block.data(); for (int i = 0; i < 19; i++){ dataBlock[i] = i +'a'; } dataBlock[20] = '\0'; qDebug("Data block is %s", dataBlock);
Returns a pointer to memory that this QMemoryFile is associated with
Returns true if memory is shared
Returns true if memory is writable
Returns the length of the block of memory that this QMemoryFile is associated with.
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|