I need to get specifications of hard disk on both Win and *nix machines. I used
on Linux like this:
static struct hd_driveid hd;
No, there is no platform-independent way. There is even no *nix way. There is just Linux way.
In Linux, all relevant information is available in various files in the /proc
filesystem. The /proc/devices
will tell you what devices there are (the files in /dev/
may exist even when the devices are not available, though opening them will fail in that case), /proc/partitions
will tell you what partitions are available on each disk and than you'll have to look in the various subdirectories for the information. Just look around on some linux system where is what you need.