|
-
September 8th, 2002, 11:04 PM
#1
Can File Stream being passed like this?
FILE* fp = fopen(filename,"wb");
if (!fp) return false;
fwrite(&Info, sizeof(SaveInfo), 1, fp);
fwrite(&m_CurrentLevelId, sizeof(m_CurrentLevelId), 1, fp);
GetObject()->Save(fp);
==================================
bool CG3DCObject::Save(FILE* fp){
int i = 100;
if (fwrite(&i, sizeof(i), 1, fp) != 1)
return false;
...
==================================
it crash when the fwrite inside object,
i wonder if file stream pointer can be passed in function like this?
If any one can help me, i will be appreiate d for ur help!!
-
September 9th, 2002, 02:52 AM
#2
Yes, FILE* can be passed as you have coded it. Can't see anything wrong with the code.
1) Is Info of type SaveInfo?
2) Does GetObject () return a value? Try assigning it to something first and then use that pointer to get to Save.
3) Failing that, it is probably caused by some undetected error which occurred earlier.
Succinct is verbose for terse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|