Re: port I/O in C

Discussion in 'C Programming' started by Jack Klein, Jul 6, 2003.

  1. Jack Klein

    Jack Klein Guest

    On Sun, 06 Jul 2003 02:40:21 GMT, "Kevin Cifuentes"
    <> wrote in comp.lang.c:

    > Hey all i need some of your help. I tried compiling this using Dev-C++ and
    > at no suprise it gave me an error. I say w/out suprise because I just
    > discovered that the _outp and possibly the _inp functions are
    > windows-specific in conio.h. I checked in conio.h provided in Dev-C++ and I
    > couldn't find the functions anywhere. Do any of you know where I can find a
    > header or library that has port I/O specific functions much similar to _inp
    > and _outp? Thanx. Here's the code:


    There is no such thing as "port I/O" in C. In fact, the language does
    not provide any access to hardware at all. And there is no such
    header as conio.h in C. If a compiler provides one it is a 100%
    completely non-standard extension, and what it might contain is
    completely different from one compiler to the next.

    > Code:
    >
    > #include <time.h>
    > #include <conio.h>
    >
    > int status;
    > if(!m_iNote) return;
    > m_iNote = (unsigned)(1193280L / m_iNote);
    > _outp(0x43,0xb6);
    > _outp(0x42,(char)m_iNote);
    > _outp(0x42,(char)(m_iNote >> 8));
    > status = _inp(0x61);
    > _outp(0x61,status | 0x03);
    > delay( (clock_t)m_iDuration );
    > _outp(0x61, status );


    As a matter of fact, there is no current marketed Windows operating
    system that even allows an application program any access to hardware
    ports. The OS will terminate the application the minute it tries to
    do so.

    But none of this is about C, it is completely about the hardware of
    the Intel x86 processors and the Windows operating system. You need
    to ask about this in a Windows group, like one of those in the
    news:comp.os.ms-windows.win32.* family.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c /faq
     
    Jack Klein, Jul 6, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John T. Goodman

    Overhead of 4-port over 2-port SRAM

    John T. Goodman, Jan 25, 2005, in forum: VHDL
    Replies:
    0
    Views:
    631
    John T. Goodman
    Jan 25, 2005
  2. Sean Wolfe
    Replies:
    1
    Views:
    2,282
    Joerg Jooss
    Apr 28, 2005
  3. b3ny
    Replies:
    11
    Views:
    941
    Babu Kalakrishnan
    Nov 20, 2004
  4. Gerald Klix
    Replies:
    0
    Views:
    1,294
    Gerald Klix
    Oct 26, 2005
  5. Pom
    Replies:
    2
    Views:
    1,721
    Bas-i
    Jan 31, 2007
Loading...

Share This Page