473,669 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6391
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,&h d);
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,&h d);
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.l earn.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
2042
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 dynamic content. Currently the database server houses all data pertinent to the organization (membership data, events, products, etc) in one database (~2.2 GB) as well as the web site content in a separate database (~40 MB). The web site pulls from...
2
1463
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 corresponding to tracks in 3d space) We think there's not much more that can be done to speed these functions up on the computer we have (or can have). The question is, aren't there available now hardware cards that you can load with particular...
6
3375
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 can get some guidlines or some sample C/C++ codes for a hardware model. Sun
4
1533
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
3418
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 tell me how t o write a assembler code in c++........ please reply..
110
10555
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 case scenario for MyISAM backend? Also is it possible to not to lose data but get them corrupted?
3
2123
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 app has options that 'talk' over the serial port to a piece of hardware, controlling it and getting information to/from it. The ASP.NET app would need to do the same think. Previously, in VB6, I believe one could do something like this by...
41
4423
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
2527
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
2515
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 Windows to look in the registry and be able to parse and search it. Any pointer to information would be appreciated. Thanks.
0
8383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8895
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8588
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6210
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2797
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.