473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Hardware information

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
3 6381
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lorax | last post by:
I'm on the IS team of a medium-sized non-profit with international reach. We're trying to make some decisions regarding our Web server and database server as we expand our web site to have more...
2
by: Mark | last post by:
We have a particular software project where a minority of the function calls are taking up a majority of the cpu time. (they do a lot of geometric, trig and other functions related to vectors...
6
by: sun | last post by:
Hello All, I wanted to develop a hardware model in C/C++ but iam not sure about the procedure, can any one help me out by providing some guidlines for developing or pointing to some wepage where i...
4
by: jenue | last post by:
Hi evreryone! Is there a way to acquire information about the hardware firewall using wmi or anything? i'm having a problem with this scenario. can anyone you guys help me? thanks, jenue
4
by: prashant | last post by:
Guys does any body know how to develop an micro operating system using c++. or tell about how to make an executable that can interect with system hardware and does not require a ms dos to run.And...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
3
by: Tom | last post by:
Is there any way to 'download' a control that could access hardware on a PC? Reason is that I am considering retooling a client-server app of ours over to ASP.NET (VB.NET). However, currently that...
41
by: x01001x | last post by:
When programming in C (not C++) how does one send information to a hardware device such as a video card or modem? How is this done in Linux C programming versus Microsoft C programming?
5
by: mohamed azaz | last post by:
hi I want to know can c++ deal with hardware?? like fax modem or Lan or Audio device
1
by: Florencio Cano | last post by:
Hi, I'm looking for a method of gathering information about the system hardware and software installed using Python. I would like to do it in UNIX and in Windows. I think that it would be good in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.