Skip to main content
gamedev.net
🔒 Locked

msvc - cant find function

Started by logout 3 replies 700+ views
Original Post
logout
logout
The problem comes when i try to compile using the function: CreateFileForMapping() So where is this function defined ? I currently include: windows.h Winbase.h // msdn say that CreateFileForMapping is defined here stdio.h any help would be ok
Promit
Promit
This is very likely relateed to an error in the code that has confused the compiler.

Can we see the relevant lines?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
logout
logout
Im just testing out mmapping so here is the entire source as it is:



#include <windows.h>
#include <stdio.h>
#include <stdio.h>
#include <iostream>

using namespace std;


void main()
{
HANDLE hFile = NULL;
hFile = CreateFileForMapping( "test_file.txt", GENERIC_WRITE | GENERIC_READ,
0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
FILE_FLAG_RANDOM_ACCESS );
if( hFile )
cout << "CreateFileForMapping - ok" << endl;
else
return;


hFile = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0,5, "test.txt" );

if( hFile )
cout << "CreateFileMapping - ok" << endl;
else
return;

char* file = (char*)MapViewOfFile( hFile, FILE_MAP_WRITE, 0, 0, 0 );
if( file == NULL )
{
cout << "MapViewOfFile - fail" << endl;
return;
}

cout << "file: " << file << endl;

UnmapViewOfFile( file );
}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.