Olevariant types are transformed into streaming, used for file storage, read

xiaoxiao2021-03-06  57

Given stream savetofile VariantToStream and StreamToVariantprocedure VariantToStream (const V: OLEVariant; Stream: TStream); var P: Pointer; begin Stream.Position: = 0; Stream.Size: = VarArrayHighBound (V, 1) - VarArrayLowBound (V, 1 ) 1; p: = varitelock (v); stream.write (p ^, stream.size); varArrayunlock (v); stream.position: = 0;

Procedure streamtovariant (stream: tstream; var v: pointer; begin v: = varArraycreate ([0, stream.size - 1], varbyte); p: = varArrayLock (v); stream.position: = 0; stream.read (p ^, stream.size); varArrayunlock (v); end;

转载请注明原文地址:https://www.9cbs.com/read-118680.html

New Post(0)