I want to save data when close program and load data when it opens. My struct like this
public ref class FormConfig
{
// Connect form
public:
static Int32 Connect_SlaveNo = 0; // + 1 // Axes number
static Int32 Connect_BaudrateNo = 0;
static Int32 Connect_PortNo= 0; // port number
static bool Connect_DemoCheck = false;
static String^ Connect_ConnectInfo = String::Empty;
};
I try to read/write my static struct data to binary file but didnot get success. I think that to read/write, the static struct need to be convert to byte array. I also used serialization but it can not work with static struct.
I also tried singleton instead of static struct but I have the same problem as this question How to do singleton serialization in C#?.
With Unmanaged C++, everything is very simple like this, but it cannot used in .Net.
struct Medicazos m = {"Bob", "Password", "Feet", 123, 456};
FILE* f = fopen(...);
fwrite(&m, sizeof(struct Medicazos), 1, f);
Can anybody help me ?