Comment dd (Score 1) 578
1) You want logical locations, not physical locations. I promise.
2) On Unix-like systems, you can open the device node, and seek directly to the locations of your choice.
int const fd = open("/dev/sda", O_RDWR);
3) If you have a predetermined image you want to slam onto the disk, use dd. Depending on what else you want to do, other command line programs may also be useful. For example:
~$ uname
Darwin
~$ sudo hexdump -n 600
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00001b0 00 00 00 00 00 00 00 00 38 2d 00 00 00 00 00 fe
00001c0 ff ff ee fe ff ff 01 00 00 00 2f 60 38 3a 00 00
00001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa
0000200 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00
0000210 ab 81 40 18 00 00 00 00 01 00 00 00 00 00 00 00
0000220 2f 60 38 3a 00 00 00 00 22 00 00 00 00 00 00 00
0000230 0e 60 38 3a 00 00 00 00 48 75 00 00 de 3e 00 00
0000240 fa 0c 00 00 7d 31 00 00 02 00 00 00 00 00 00 00
0000250 80 00 00 00 80 00 00 00
0000258
~$
Good luck.