Hola, tengo que leer el com1, pero no me funciona, aparece el error:(0xC0000096: Privileged instruction), este es el código,desde ya muchas gracias a quienes puedan ayudarme:
 
// serial3.cpp: define el punto de entrada de la aplicación de consola.
//
 
#include "stdafx.h"
#include "stdio.h"
#include "windows.h"
#include "conio.h"
#include "iostream"
#include "dos.h"
int _tmain(int argc, _TCHAR* argv[])
{
	int val,i;
 
    HANDLE hDevice = CreateFile(L"COM1",GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,0);
 
     if (hDevice !=INVALID_HANDLE_VALUE)
    {
        printf("Port opened! \n");
        DCB lpTest;
        GetCommState(hDevice,&lpTest);
        lpTest.BaudRate = CBR_9600;
        lpTest.ByteSize = 8;
        lpTest.Parity = NOPARITY;
        lpTest.StopBits = ONESTOPBIT;
        SetCommState(hDevice,&lpTest);
    }
 printf("Ejecutando programa\n");
 Sleep(100);
 val=0;
 for (i=1;i<50;i++)
 {
	 printf("vuelta %d\n",i);
	 val = inp(0x3F8);
	 printf("Valor pto: %d\n",val);
	 Sleep(10000);
 }
 
	return 0;
} 
  
 

