Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
What are the various header files available in C++ for hardware interface except built-in header files.
Posted
Updated 30-Apr-11 3:54am
v3

It depends a lot on the hardware you are dealing with and the OS you're developing for (standard C++ doesn't deal directly with hardware devices, you need libraries)
Hence give more details and, as requested by the Q&A guidelines, be specific.
 
Share this answer
 
C++ has no standard for hardware, the same as it having no support for multithreading, input devices or even a monitor. These are all things provided externally through API. For hardware you will need to find a driver that uses the hardware or an intermediate layer like DirectInput that does the driver side for you.
 
Share this answer
 
C++ is platform independent, which means it has no intrinsic knowledge of the hardware it's running on. There are header files such as stdio.h, io.h, and conio.h, which I assume is what you meant by "built-in" header files.

In Windows, the hardware layer is abstracted by the functions provided by Win32 and the Platform SDK, and (at an even lower level) by the DDK. You can download these SDKs from Microsoft and examine the header files that will be installed on your system.
 
Share this answer
 
Comments
Ajay Vijayvargiya 2-May-11 0:27am    
Platform Independent? Then what is Java?
Hans Dietrich 2-May-11 0:35am    
Who cares?
Niklas L 2-May-11 2:27am    
I fail to see what a (correct) statement about C++ has to do with any other language.
Stefan_Lang 2-May-11 9:59am    
Ajay, if you're referring to the binaries that C compilers produce and the P-code that Java produces, that has got nothing to do with platform dependencies, nor hardware dependency. Both languages, as a language are neither dependent on platform, nor hardware. The C++ compiler is, as is the Java Runtime, but neither has anything to do with the dependencies of the source code.
Ajay Vijayvargiya 2-May-11 10:13am    
I agree with you Stefan. But when asked "platform dependent language", obvious answer would be C/C++, and when asked "PI language", Java would come out. A Java compiler produces byte-code, and therefore it can be executed on compliant JVM without any changes - the same binary can be shipped to multiple platforms. But that's not possible with C++ - it is native binary. And that's the reason languages are categorized.
First thing you need to know is User Mode and Kernel Mode execution. Your program is user-mode program, and cannot directly access the hardware. To access the hardware, you program must be executing the instruction in kernel-mode. Device drives, for example run in kernel mode, and they need installation (Driver installation, heard this term?).

See Task Manager 'Show Kernel Times' - find yourself where it is!

Device drives are nothing but services (cannot be seen from services.exe, but can be enumerated using Service Functions[^].

Therefore you need to learn (study, read!), about user-mode and kernel-mode, and how they fit in with services. Start writing your own service (not device driver), and then jump to device-driver development if you can.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900