Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-05

writing to dynamic array via formal parameter; what is the right way

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Пётр Косаревский

I use something like

var a: array of byte;
setlength(a,TheSize);
blockwrite(afile,a[0],TheSize);

Of course, if it is possible that TheSize=0, I have to write "if TheSize>0 then blockwrite(...);"

Is this the intended way? (Ok, that's not a big overhead, but it seems strange to me.)

What is the intended way (if it's somewhat different)?