Hardware information

M

Marco

Hi
anyone can tell me how take hw information (hd serial number or usb token
serial number) without use classes
I'm using c

Thank's
marco
 
V

Victor Bazarov

Marco said:
anyone can tell me how take hw information (hd serial number or usb token
serial number) without use classes
I'm using c

(a) If you're using C, why are you asking in a C++ newsgroup?

(b) Neither language has any means to communicate with hardware.
You need to use some platform-specific methods. Please post
your query to a platform-specific newsgroup.
 
S

SnaiL

It depends on operating system you using.
If you are using Linux:

#include <stdio.h>
#include <fcntl.h>
#include <linux/hdreg.h>

int main()
{
struct hd_driveid hd;
int ide;
ide=open("/dev/hda",O_RDONLY);
ioctl(ide,HDIO_GET_IDENTITY,&hd);
printf("Serial number - %s\n",hd.serial_no);
return 1;
}

maybe NetBSD?:

man atactl -> read atactl code ...

or FreeBSD?:

look at
atacontrol - cap command
 
T

Thomas Matthews

SnaiL said:
It depends on operating system you using.
If you are using Linux:

#include <stdio.h>
#include <fcntl.h>
#include <linux/hdreg.h>

int main()
{
struct hd_driveid hd;
int ide;
ide=open("/dev/hda",O_RDONLY);
ioctl(ide,HDIO_GET_IDENTITY,&hd);
printf("Serial number - %s\n",hd.serial_no);
return 1;
}

maybe NetBSD?:

man atactl -> read atactl code ...

or FreeBSD?:

look at
atacontrol - cap command

Do you have information for an ARM based embedded system,
using the Nucleus Plus operating system?

Do you have information for a SPARC based embedded system
runing VRTX operating system?

In other words, platform specific solutions should
be posted in platform specific newsgroups, regardless
of the language being used.

All the world is not a Linux, Windows, Mac, VMS, etc.
platform.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Need help with this script 4
Can't solve problems! please Help 0
Information with WMI in Python. 1
Hardware 11
Hello there ! 2
Tasks 1
Only one table shows up with the information 2
Processing in Python help 0

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top