[fpc-pascal] Get empty memory quickly or... an empty file

Reinier Olislagers reinierolislagers at gmail.com
Fri Sep 13 15:43:30 CEST 2013


On 13/09/2013 15:38, Marco van de Voort wrote:
> In our previous episode, Reinier Olislagers said:
>> However, I'm sure there must be quicker ways (e.g. less newbie code;
>> using OS functions to quickly create empty memor, or alternatively
>> create a sparse file and zip the file instead of the stream).
> 
> Do not create the data, but generate it in an overriden tstream read() call? 
> 
> If you can define a function that can generate "count" bytes of data at
> position n (in this case the function is constant), then you don't have to
> write it out.
> 
> Ken in mind that TStream is an abstraction, not necessarily a block of
> (RAM or disk) memory.

Mmm, yes, that sounds very smart, thanks!




More information about the fpc-pascal mailing list