Hello, I have such a problem. I put windows7 on the virtual machine, in the virtual machine I set the com1 port setting to associate as the 1.txt file (there it was possible to do this) in my ubunt. In visual studio 2015 wrote a program:
#include <windows.h> #include <iostream> #include <io.h> #include <stdio.h> #include <fcntl.h> using namespace std; int main(void) { HANDLE h; h = CreateFile(L"COM1", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h != INVALID_HANDLE_VALUE) { cout « "OkOpen" « endl; } else { cout « "Bad" « endl; getchar(); return 0; } char buf[25]; memset(buf, 0, 25); strcpy(buf, "hell is my name"); DWORD wtn; OVERLAPPED ol; WriteFile(h, buf, 25, &wtn, &ol); cout « wtn « endl; FlushFileBuffers(h); CloseHandle(h); getchar(); return 0; } But he does not write anything to the 1.txt file. What could be the problem, while the prog issued OkOpen Thanks in advance.