Colin,
Whether you use bytes or integers is up to you. What are you wanting to
achieve? The standard integer type is 4 bytes, not 2, remember. Delphi
will optimise for speed, and so will put each element of your byte array on
even addresses, so use the 'packed' keyword in your array declaration.
I presume the buffer you refer to is for 'TField.GetData' . Just declare a
variable of adequate size, as you've done with 'Program Data' - but use the
packed directive with both array declarations (e.g. Data : packed array
[1..2006] of byte) and pass a pointer to that - or use something like
getmem or new to allocate a block from the heap (and of course freemem when
you're finished with it). It just needs to be big enough for your needs -
you should check before copying data to it.
Terry
>Hi, I need some help,
I am having difficulty passing information between a BLOB field in a
database and an array in memory and would appreciate it if someone familiar
with the process would provide me with some sample code.
The array I have is "Program Data", as follows :-
type
DataLocations = record
Data : array[1..6] of byte; { Can I define the array as
byte or should I pack two bytes into integers ?}
end;
var
ProgramData : array 1..200 of DataLocations;
When accessing any record in the database I need to get the data in its
Blob field into Program Data, maybe modify it, then
put it back when done with the record.
I believe I have to first Create then later Destroy the buffer, but don't
really understand how this is done. I imagine it's pretty simple but its
got me beat.
TIA
Colin
<
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz