Original Post
Hi I have finally maganged to get the CreateFile funciton to work
and write a file but I can only get it to write binary files. Does it write plain text files and allow you tp append them also??
Also below is the code I have used to wirte a binary file, the only way I could get it to work was to make the structure variable an array. Is this the proper way of doing it, to me it doesn''t seem right.
I would appreciate any help, thankx.
struct MapType {
int nPlayer1XPos;
int nPlayer1Ypos;
int nPlayer2XPos;
int nPlayer2Ypos;
};
MapType map[1];
DWORD dwNumRead=0;
HANDLE hFile=CreateFile("map1.dat",GENERIC_WRITE,0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
WriteFile(hFile,map,sizeof(MapType),&dwNumRead, NULL);
CloseHandle(hFile);