Original Post
Hello, i'm working on a small game in C++ right now, and I needed a MonsterObject Creator, so since C# seems faster and easier for such a thing, I decided to make the MonsterObject Creator with C#.. Right now I have a monster structure, like this.. Im wondering what the best way is to write a bunch of structures like that to a binary file that can be read in C++..I figured a BinaryWriter was really the only way to go.. And Then a bonus...how would I read that in C++ (I guess it's hard to know how to read it until you know how your writing it though huh?)
struct MonsterStruct
{
string sName;
int ID;
int HP;
int Sight;
int Speed;
bool bFriendly;
float RespawnRate;
int ObjectDropped1;
float fValue1;
int ObjectDropped2;
float fValue2;
};
MonsterStruct[] Monster;
Monster = new MonsterStruct[255];
//Pretend Monster is a MonsterStruct array of 255 and is already created and filled
FileStream fs = new FileStream("Monsters.dat", FileMode.CreateNew);
BinaryWriter w = new BinaryWriter(fs);
//What would be the easest way to write it?
w.Write(??);