Home > Back-end >  C Builder floating-point array is converted into a memory stream
C Builder floating-point array is converted into a memory stream

Time:11-02

Everyone a great god, and I am the new, do not understand c + + memory flow, I would like to ask in the c + + or c + + Builder how to convert floating point array to TMemoryStream flow

CodePudding user response:

Is there a way to, ah, my friends, urgent urgent

CodePudding user response:

First address can type into the write floating-point array need the type of writing memorystream, pay attention to the size, didn't try, you can try

CodePudding user response:

A float array []=...
Stream. WriteBuffer (array, sizeof (array));

CodePudding user response:

TMemoryStream * fs=new TMemoryStream ();//to compress the original memory flow
TMemoryStream * ms=new TMemoryStream ();//receive the compressed file flow
Fs - & gt; Write (f, 4000);
Fs - & gt; The Position=0;
Int fsize=0;
Fsize=fs - & gt; The Size;//file size
Ms - & gt; WriteBuffer (& amp; Fsize, sizeof (fsize));//set up receiving flow and write to the original file size
Cs=new TZCompressionStream * TZCompressionStream (ms, zcDefault);
Fs - & gt; SaveToStream (cs);//to compress the data
Ms - & gt; SaveToFile (" F: \ \ 1. Zip ");//save
ShowMessage (" finished ");
Delete the fs.
The delete ms;
The delete cs;
I use the above code to Zlib compression, decompression and found is wrong, what's the problem
  • Related