- Код: Выделить всё
...
..char buffer[25];..
memset(buffer,0,sizeof(buffer));
strcpy(buffer,"Hello LPT ");
DWORD dw;
OVERLAPPED ov;
..for (int x=0;x < 3;x++)..
WriteFile(hLPT,buffer,sizeof(buffer),&dw,&ov);
...
...
..char buffer[25];..
memset(buffer,0,sizeof(buffer));
strcpy(buffer,"Hello LPT ");
DWORD dw;
OVERLAPPED ov;
..for (int x=0;x < 3;x++)..
WriteFile(hLPT,buffer,sizeof(buffer),&dw,&ov);
...
http://www.firststeps.ru/mfc/winapi/r.php?12 писал(а):#include "stdafx.h"
#include "windows.h"
#include "iostream.h"
void main()
{
HANDLE hLPT=CreateFile("LPT1",GENERIC_WRITE,0,NULL,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (hLPT!=INVALID_HANDLE_VALUE)
{
cout << " Ok Open LPT1" << endl;
char buffer[25];
memset(buffer,0,sizeof(buffer));
strcpy(buffer,"Hello LPT ");
DWORD dw;
OVERLAPPED ov;
for (int x=0;x < 3;x++)
WriteFile(hLPT,buffer,sizeof(buffer),&dw,&ov);
CloseHandle(hLPT);
}
else cout << "Error Open" << endl;
}
Open "LPT1" For Output As 1
For x = 0 To 2: Print #1, "Hello LPT ";: Next
Close 1
Сейчас этот форум просматривают: Majestic-12 [Bot] и гости: 90