Original Post
I'm trying to output a simple binary file with c++ (for a map file, but that's not important). But my code (see below) just results in the creation of an empty file. The code looks like this: I assume the syntax is right (if not, please help me - I just can't see any error). Btw (if it's an system-related problem), I'm running Win XP (yeah, ugly) and I'm compiling with MingW (I think GCC 2.95.2). And finally: I tried the same with a c-script, and it worked without problems (but I really want to use c++ if possible - please don't argue about that ^^).
#include <fstream.h>
#include <string>
using std::string;
struct OBJECT
{
int number;
char letter;
} obj;
int main () {
string filename = "G:/Projekte/Allegro/Isometric/ASCII Edit/test.lvl";
ofstream level (filename.c_str(),ios::binary);
obj.number = 15;
obj.letter = 'M';
level.write((char *)(&obj), sizeof(obj));
level.close();
system("PAUSE");
return 0;
}