By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 817 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

Hardware information

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Marco wrote:
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.
Jul 23 '05 #2

P: n/a
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

Jul 23 '05 #3

P: n/a
SnaiL wrote:
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

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.