FILE IO Error
Posted: Sat Oct 22, 2011 4:40 am
Error line 16 Incompatible Types: Cannot convert from 'double' to ' * const char '
- Code: Select all
typedef struct NewStruct
{
int a;
int b;
char c[20];
} NewStruct;
NewStruct myStruct;
FILE *g_DATAMAPFILE;
NewStruct * pMyStruct = &myStruct;
int SaveDataMap()
{
g_DATAMAPFILE = fopen("Level.txt", r+b); //fopen error
if(g_DATAMAPFILE == NULL) {return 1;}
fwrite(pMyStruct, sizeof(*pMyStruct), 1, g_DATAMAPFILE);
fclose(g_DATAMAPFILE);
return 0;
}
void init()
{
pMyStruct->a = 20;
pMyStruct->b = 55;
strcpy(pMyStruct->c, "String");
if(!SaveDataMap()){ExitGame();}
}