Try this:
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <windows.h>
int main(int argc, char *argv[])
{
// Windows manages access to the parallel port. The easiest way to send
// output to the parallel port is to use the Windows API.
HANDLE hParallelPort;
BOOL fSuccess;
DWORD dwBytesWritten;
char buf [MAX_PATH];
memset(&buf,0,sizeof buf);
hParallelPort = CreateFile("LPT1", GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE != hParallelPort)
{
sprintf(buf,"Question: Who shaves the barber?\r\n");
fSuccess = WriteFile(hParallelPort, &buf, strlen(buf), &dwBytesWritten, NULL);
if(fSuccess)
{
sprintf(buf,"Answer: She doesn't need to shave.\r\n");
fSuccess = WriteFile(hParallelPort, &buf, strlen(buf), &dwBytesWritten, NULL);
}
// All done Free resources
fSuccess = CloseHandle(hParallelPort);
}
return fSuccess;
}
Regards,
DMac