[fpc-pascal] FillWord with dynamics array.

Luis Fernando Del Aguila Mejía luis3000 at ec-red.com
Fri May 27 02:29:35 CEST 2011


Thanks. Gracias.

El 26/05/2011 05:01 p.m., Jonas Maebe escribió:
> On 26 May 2011, at 23:18, Luis Fernando Del Aguila Mejía wrote:
>
>> How fill of the same value a dynamic array?
>>
>> {$codepage utf8}
>> Var A,B:array of word;
>>       i:integer;
>> Begin
>>   SetLength(A,10);
>>   SetLength(B,10);
>>
>>   FillWord(A[0],2*10,0);  //when value diferent to zero, no runtime error
> FillWord fills per word (= 16 bit). So you are filling 2*10 = 20 words, while you only allocated 10. Use fillchar if you want to specify the number of bytes.
>
>
> Jonas
>




More information about the fpc-pascal mailing list