Answers for "C++ create file mapping object"

C++
1

C++ create file mapping object

#include <Windows.h>
#include <tchar.h>

int main() {
  	/*
    	This creates a file mapping object that can only READ the file
        see: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
    */
  
	HANDLE fileHandle = CreateFile(
        _T("combatlog.txt"),
        GENERIC_READ,
        FILE_SHARE_READ,
        NULL,
        OPEN_EXISTING,
        FILE_ATTRIBUTE_NORMAL,
        NULL
    );
}
Posted by: Guest on July-21-2021

Browse Popular Code Answers by Language