I am accessing MBR to get the first 512bytes from hard disk by using absread() function in C programming.
But it is showing error: "you are executing a program which directly accessing the hard disk and it works improper. Close to terminate the program". If i ignore that then it is not reading the 512 bytes instead filling the buffer with garbage values.

If anybody know how to solve this problem, please message me.
Hoping for the positive replies....

Let me guess: you are using an ancient compiler such as Turbo C in MS-Windows operating system. If that is correct then you can forget about doing that because the os will not allow it, as you have already found out.