inportb() again, sorry
Ok, yes i know of google, but lifes too short to sort through thousands of articles and manuals that do not answer my question.
value = inportb(0x378);
I am using port talk to allow me access to COM1 on XP. The above code was supplied.
My only aim is to read data sent to the port from some electronics i have been doing. I have set up the port to recieve the data, and terminal software is recieving an input, so data is comming in.
Now the question is, how do i get the port name to go between the brackets?
At the moment i am only getting 0xFF returned. So i am guessing somming is worng ;).
According to the device manager the I/O range is 03F8 to 03FF. Anyone got any ideas.???
Well inportb() assumes 2 things
1. That you're using DOS. Nothing else allows such unfettered access to the hardware. I note from your post that you're using XP, so that means you're not using DOS.
You might think your black rectangle of a c:\> prompt is DOS, but it isn't.
2. You need a DOS compiler. From your previous posts, you seem to be using DEV-C++.
This isn't a DOS compiler, though it can generate win32 console programs. Despite their superficial similarity to DOS boxes of old, they're not DOS either.
And scroll down to "Communications Resources"
Arrg, ok thanks
Starting to hate documentation, it was just a copy past thing. nm
What include do i need to use create file?
depends. If you are using a console program or DOS you can use straight C++ file handling which associates a file with a stream, like this:
char fileName = "myFile.txt";
By default, if myFile.txt doesn't exist it will be created. If it does exist the data in it will be overwritten and the file will be started from scratch (you loose anything that was in the file originally). Since those two options aren't what you want all of the time, there are a number of ios flags that can be used to do what you want with regard creation/use of files. the streams used to manipulate files: fstream, ifstream, and ofstream; are in the header file called iostream (or iostream.h if you have an older compiler).
If you are using Windows or some other API or if you want to use a pure DOS command in your program, there are ways to do it, but you need to be able to state exactly what you are trying to do with what equipment/tools so you get the answer most applicable to your situation.