HDD Serial Number

I need to make a programa for DOS in C in order to get hard disk's serial number or the MAC address (net card). I have to put it on the autoexec.bat so it has to work in MS-DOS. Please send code.
LVL 1
quiqueAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jhurstConnect With a Mentor Commented:

  {FILE *fil;
  char str[100];
  system("vol  >temp.fil");   /* gets the label and serial number */
  fil=fopen("temp.fil","rt");   /* read what we made */
  while (fgets(str,90,fil))     /* get to the line we need */
    if (strstr(str,"Serial Number")) /* are we are at the serial number line? */
      break;                         /* yes */
  fclose(fil);                        /* done with it */
  unlink("temp.fil");             /* clean up after ourself */
  strcpy(str,strstr(str,"Serial Number")+17); /* just the serial number */

  /* we now have the serial number in str */
  }

0
 
quiqueAuthor Commented:
OK, but I need the serial number from the company who makes the hard disk.
0
 
quiqueAuthor Commented:
OK, but I need the serial number from the company who makes the hard disk, not the serial number from the formatting.
0
All Courses

From novice to tech pro — start learning today.