|
|
View previous topic :: View next topic |
Author |
Message |
n00blet
Joined: 30 Jun 2005 Posts: 1
|
Serial output in C++ |
Posted: Thu Jun 30, 2005 10:02 am |
|
|
I am currently trying to test the interrupts in one of my the programs I wrote for a pic by coding a program for windows that will output to COM1 every second. However, I've searched all over the internet and cannot find anyway to do serial output in c++. I tried the #use preprocessor that I used in c, but it doesn't seem to be supported in c++. Can anyone help me get serial output in c++? |
|
|
Ttelmah Guest
|
|
Posted: Thu Jun 30, 2005 10:20 am |
|
|
You seem to be getting confused.
#use, is specific to the CCS C, and has nothing to do with either C, or C++. It is a way of defining the hardware setup for the I/O port involved. By default C, and C++, are normally running inside an operating system, so serial I/O, can just be done by the file I/O operations (which CCS does not have, since it is not run inside an OS). The default display, is normally preprogrammed to use the 'STDIO' port, allowing this to be used by default by the getc, putc, printf etc., functions.
Every operation supported in C, is available in C++.
For C++, using it's own I/O model, you normally need to include the stream handling header files, and you can then use the 'cin', 'getline', and the 'cout' operators, with the '<<', and '>>' directors. I/O is just another 'stream' in C++.
Best Wishes |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|