csteinhilber
Programmer
It's late, I'm getting punchy, and I know I'm just missing something stupid... but I figured a few more sets of eyes on this would do wonders.
I'm trying to create a helper/wrapper function around a file open, such that I can pass in a mode, and the function will return the pointer to the file for subsequent reads/writes.
But every attempt so far has resulted in an "invalid conversion" error of some type or other on compile.
This version specifically errors @ file = (FILE *) &GetGameSaveFile('rb'); with "invalid conversion from 'int' to 'const char*'".
I know I have a pointer wrong somewhere, but I just don't see it.
Anybody have any insight?
Thanks in advance,
-Carl
I'm trying to create a helper/wrapper function around a file open, such that I can pass in a mode, and the function will return the pointer to the file for subsequent reads/writes.
But every attempt so far has resulted in an "invalid conversion" error of some type or other on compile.
Code:
void SFileMgr:ReadSave()
{
FILE *file=NULL;
file = (FILE *) &GetGameSaveFile('rb');
nb=fread(&content,sizeof(content),1,file);
}
FILE SFileMgr::GetSaveFile(const char mode)
{
switch(SUserMgr->GetSlotNum())
{
case 1:
{
return fopen("file1.sav", mode);
}
case 2:
{
return fopen("file2.sav", mode);
}
case 3:
{
return fopen("file3.sav", mode);
}
default:
{
return fopen("file0.sav", mode);
}
}
This version specifically errors @ file = (FILE *) &GetGameSaveFile('rb'); with "invalid conversion from 'int' to 'const char*'".
I know I have a pointer wrong somewhere, but I just don't see it.
Anybody have any insight?
Thanks in advance,
-Carl