Hi Everybody,
Im a new programmer.........
i had used the following code to output data to com port.....
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<bios.h>

#define SETTINGS (_COM110|_COM_CHR7|_COM_STOP1|_COM_NOPARITY)
void main()
{
clrscr();
_bios_serialcom(_COM_INIT,0,SETTINGS);
outportb(0x03f8,0);
getch();
}

when i run the programme,when i connect pin 3(tx pinn) to a LED it blinks one tym..........

so how can i tx a file..............

how can transmit relevent characters in binary....(how to convert it to binary........)

how i can use inportb() methord?

Please help me.............................

if u know more details please tell me........
if u got more teaching meterials please mail to <email address snipped> okk

There are many libraries that will do all the hard work for you, requiring just a stream of bytes as input and producing a stream of bytes as output on the other end.

But you can indeed do it all yourself, by taking each byte, pulling it apart into bits, and pumping it over the connection like you did that single blip.

how i can use inportb() methord?

See in the help section. It needs the port id as the argument and returns the byte received at that port.

But, it would definitely be easier to use the libraries as jwenting suggested.

If your purpose is just to transmit or receive a file, use hyperterminal instead. It will do all the low-level stuff on its own.

this program cannot use in Microsoft visual c++

Specify the errors you encounter.

Don't use old style header files. And yes, void main() must be replaced by int main() ;).

This article has been dead for over six months. Start a new discussion instead.