i am trying to write a simple program for formating a hard disk or disk drive for a simple filesystem from where i can get good help related to source code!
thank you in advance for help!
Assuming this is a userspace program (you shouldn't be formatting partitions from kernelspace, anyway...), you just have to open() the partition via its device special file (e.g. /dev/hda1) and write() away. You'll likely also need ioctl() to do stuff such as determining the disk geometry. Manpages are your friends.