delphi - Why do I get an access violation when I call FillChar? -
consider sample code:
var p512sector:pbyte; ..... getmem(p512sector, 262144); fillchar( p512sector,262144 ,0);
when run program, delphi gives me violation access error. why?
use fillchar(p512sector^, 262144, 0)
(note dereferencing ^). otherwise overwriting pointer , stuff behind in memory, not allocated buffer.
Comments
Post a Comment