Hardware information

Discussion in 'C++' started by Marco, Feb 17, 2005.

  1. Marco

    Marco Guest

    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
     
    Marco, Feb 17, 2005
    #1
    1. Advertisements

  2. (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.
     
    Victor Bazarov, Feb 17, 2005
    #2
    1. Advertisements

  3. Marco

    SnaiL Guest

    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
     
    SnaiL, Feb 17, 2005
    #3
  4. 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
     
    Thomas Matthews, Feb 17, 2005
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.