Witam...
Korzystam z biblioteki inpout32.dll do sterowania portem lpt. i problem polega na tym że każda pętla for w ktorej znajduje się jakaś instrukcja z tej biblioteki wykonuje się 5 razy. a wartość zmiennej pętli jest następująca
i=0
i=1
i=2
i=3
i=4
i=4696969
nie wiem skąd bierze się ostatnia wartość.
Oto kod programu:
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
//******************************************************************
//uchwyt dll-ki oraz wskazniki do funkcji
HINSTANCE hDLL;
typedef USHORT (*InPortType) (USHORT BasePort);
typedef void (*OutPortType)(USHORT BasePort, USHORT value);
InPortType InPort;
OutPortType OutPort;
//******************************************************************
//******************************************************************
//ladowanie dll-ki
hDLL = LoadLibrary("inpout32.dll");
if (hDLL)
{
InPort = (InPortType) GetProcAddress(hDLL, "Inp32");
OutPort = (OutPortType) GetProcAddress(hDLL, "Out32");
}
else
MessageBox(NULL,"ERROR","Błąd przy ładowaniu pliku",MB_OK);
//******************************************************************
//******************************************************************
for (int i=0; i<20; i++)
{
OutPort(0x378,0xff);
cout <<"\n i="<<i; //odebranie danej
}
//******************************************************************
getch();
}
Pozdrawiam...
I proszę o pomoc...