i just learned that i could write classes to a file using the function fwrite(). (defined in stdio)
and i was wondering if i could write the whole class in one of its own functions, perhaps something like this:
Code:
#include <stdio.h>
class dot{
private:
int x;
int y;
wchar_t* title;
public:
void tofile(void);
///some other unnecessary functions///
};
void dot::tofile(void)
{
FILE* file;
file=fopen("dotfile.dat","w+");
fwrite(&dot,sizeof(dot),1,file); ///this is where i am not sure of
fclose(file);
}