check disk for bad sectors from an application

Hi,

I need to check my disk for bad sectors irrespective of the filesystem on it. I can use dcheck from the command line and want to avoid using system/spawn APIs from my application.

If there is any alternative to system/spawn APIs, ps let me know.

no there isn’t any API for that. You’ll have to start dcheck from within your application with system or popen

Well you could use open on /dev/hd# and try reading each sector. There’s a read routine with the word “block” in the name that will get you around the 2Gig file limit.