You are here:

C++/Parallel Port


I need to get the output from an A to D converter inputted into a computer using a parallel port. I was wondering if C++ would be a good language to use for this task, and if you could explain how I would go about doing this?

The answer depends on what you mean by a parallel port and what operating system (if any) you are using.

If you mean a device such as a parallel printer port on PC systems then you will often find they can be opened like files, using the (system specific) device name instead of a file pathname (e.g. "LPT1" on a Windows system).

On the other hand if, as is quite likely in this case, you mean direct processor I/O port access, either memory mapped or x86 style separately addressed IO ports then C++ has no direct support for accessing such hardware resources other than the implementation defined asm declaration (which is typically used to pass information to an assembler). Any such support is provided as (non standard) library and/or language extensions. On some systems you may require a device driver to access hardware resources as the operating system protects such resources from direct user access (this is true of modern desktop and server operating systems such as MS Windows NT,2000,XP, UNIX and Linux for example).

For more general information on this sort of thing see for starters

However once you have the low level access primitives sorted out then yes I think C++ would be a very good language for this sort of task. How these primitives are implemented is implementation defined. If no such support is provided for your C++ compiler and assuming you have access to the hardware resources you require then such support could be as simple as a few of short assembler functions that have a C calling interface. If you require a device driver to access the hardware resources then you might like to consider writing a device driver for your specific device (the A to D converter) rather than using a (potentially less secure) generic device driver that exposes system hardware ports to user code. Again how to write device drivers is not a C++ issue (and not something I am an expert at) but an issue specific to whatever operating system(s) you are targeting your device for use with.

There is some information from the C++ Standards Committee (see on C++ performance and hardware interfacing see Specifically I think chapter 7 onward of this document will be of some interest to you if you are thinking of using C++ for low level hardware and/or with embedded systems. There are some more article links on this site on related subjects at


All Answers

Answers by Expert:

Ask Experts


Ralph McArdell


I am a software developer with more than 15 years C++ experience and over 25 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.


My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at


©2017 All rights reserved.