It was tested, but only lightly.
I have since discovered there was a TYPO in it which meant it only worked if you included windows.h, which I was doing accidently.

To fix, replace all the #define's with what is in it now. (Ive fixed the header-post code).
Or find the line long __stdcall BuildCommDCB(char lpDef, long lpDCB); and replace it with long __stdcall BuildCommDCB(char* lpDef, long lpDCB);
(just one missing asterix...)

I have been doing my testing using a null-model cable connecting twp PC's and using the windows program "HyperTerminal" on the 'other' PC.
(The code was tested using a "factory" null-modem cable with both real serial ports and ONE type of USB->Serial adapter, that fakes a serial port very well)

NOTE: I think I MAY have found a minor bug that is preventing the port from being configured correctly.
This USED to work, so it shouldnt be too hard to fix. Im looking at it now.
NO FAULT FOUND

the_mehmaster :: here is a test "main" for you to try. All it does is display the last byte recieved.
If you need something more 'specific' than this, let me know what you are doing...
MAIN.C
Code:
#include <acknex.h>
#include <default.c>
#include "Port_IO.h"

TEXT* debug = {  pos_x=20;  pos_y=20;  size_y=400; font="Arial#20b";  strings=20;  flags=SHOW + WWRAP;  }

function main()
{
	wait(1);	level_load(NULL);	wait(1);	diag("\n\n\n");
	on_esc = NULL;
	//
	//
	byte last_recieved = 0;
	var hPort = port_open_read("COM1", "9600,n,8,1");
	//	
	while(1)
	{
		if(port_read_bytes(hPort,&last_recieved,1))
		{
			str_cpy((debug.pstring)[0], "Last Byte Recieved = ");
			str_cat((debug.pstring)[0], _chr(str_for_int(NULL,(long)last_recieved)));
		}
		if(key_esc)	break;
		wait(1);
	}
	port_close(hPort);
	//
	//
	sys_exit("");	
}



Last edited by EvilSOB; 07/29/09 23:58.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial