Solved

HDD Serial Number

Posted on 1998-12-16
3
457 Views
Last Modified: 2008-03-17
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.
0
Comment
Question by:quique
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
jhurst earned 50 total points
ID: 1255197

  {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
 
LVL 1

Author Comment

by:quique
ID: 1255198
OK, but I need the serial number from the company who makes the hard disk.
0
 
LVL 1

Author Comment

by:quique
ID: 1255199
OK, but I need the serial number from the company who makes the hard disk, not the serial number from the formatting.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question