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

Popular posts from this blog

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -