{{vs:open1.jpg}} {{vs:open2.jpg}} {{vs:config1.jpg}} /* Handle.cpp */ #undef UNICODE #include // CreateFile, ... #include // printf, scanf int main (int argc, char * argv []) { HANDLE h = CreateFile ("abc.TXT", // pointer to name of the file /* GENERIC_READ | */ GENERIC_WRITE, // access (read-write) mode 0, // share mode NULL, // pointer to security attributes OPEN_ALWAYS, // how to create FILE_ATTRIBUTE_NORMAL, // file attributes NULL // handle to file with attributes to copy ); if (h == INVALID_HANDLE_VALUE) { int n = GetLastError (); printf ("CHYBA %d", n); } else { char pole [] = "ABCD"; DWORD delka = 4; DWORD odpoved; BOOL b = WriteFile (h, pole, delka, &odpoved, NULL); if (! b || odpoved != delka) printf ("CHYBA PRI ZAPISU \n"); else printf ("POVEDLO SE TO \n"); CloseHandle (h); } /* ReadFile WriteFile FileSeek CloseHandle CreateFileMapping */ printf ("Stiskni enter \n"); char c; scanf_s ("%c", &c); return 0; } {{vs:small.vcproj}}