You do not need to write a driver or anything else - you just call CreateFile with the file name, for example, "LPT1" to open it and then you can use WriteFile to write data to it. For instance:
HANDLE parallelPort = CreateFile("LPT1", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if(parallelPort == INVALID_HANDLE_VALUE) { // handle error } ... // Write the string "foobar" (and its null terminator) to the parallel port. // Error checking omitted for expository purposes. const char *data = "foobar"; WriteFile(parallelPort, data, strlen(data)+1, NULL, NULL); ... CloseHandle(parallelPort);
source share