Solved

HDD Serial Number

Posted on 1998-12-16
3
431 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now