Sure, but dynamically allocating memory is what we are trying to avoid here :-)
If that would be OK the easiest way would be to use use the original code.
As already mentioned, this allocates a single char.
or simply have a QByteArray member in your class and either initialize it with the buffer size or call reserve() with the buffer size.Qt Code:
char *buffer = new char[1024]; // allocate 124 charsTo copy to clipboard, switch view to plain text mode
Nice side effect of this is that you don't have to take care about deleting the memory later on.
Cheers,
_






Reply With Quote

Bookmarks