Salve,
volevo creare una struttura composta da variabili int e da un'altra struttura contenente TCHARs.
Codice PHP:
struct formPref
{
int top; // Seek 0 (4 Bytes)
int left; // Seek 4 (4 Bytes)
int indexDevice; // Seek 8 (4 Bytes)
int indexSamples; // Seek 12 (4 Bytes)
int indexBitrate; // Seek 16 (4 Bytes)
int indexMode; // Seek 20 (4 Bytes)
int indexEmphasis; // Seek 24 (4 Bytes)
int indexServer; // Seek 28 (4 Bytes)
struct formPrefString
{
TCHAR szName[128]; // Seek 32 (128 Bytes)
TCHAR szGenre[64]; // Seek 160 (64 Bytes)
TCHAR szWeb[128]; // Seek 224 (128 Bytes)
};
};
avrei voluto riempire la struttura in questo modo ma non credo sia il modo giusto:
codice:
// Fill Struct
//
formPref fp;
memset(&fp, 0, sizeof(fp));
fp.top = 65535;
fp.left = 0;
fp.indexDevice = 15;
fp.indexSamples = 40;
fp.indexBitrate = 10;
fp.indexMode = 60;
fp.indexEmphasis = 999999999;
fp.indexServer = 16776960;
formPref::formPrefString fps = { _T("Name.."), _T("Genre"), _T("Web....") };
Ma tuttavia non posso accedere ai campi tramite: fp.formPrefString ...
come dovrei organizzare la struttura?
NB, all'inizio avevo una struttura tipo:
codice:
struct formPref
{
int top; // Seek 0 (4 Bytes)
int left; // Seek 4 (4 Bytes)
int indexDevice; // Seek 8 (4 Bytes)
int indexSamples; // Seek 12 (4 Bytes)
int indexBitrate; // Seek 16 (4 Bytes)
int indexMode; // Seek 20 (4 Bytes)
int indexEmphasis; // Seek 24 (4 Bytes)
int indexServer; // Seek 28 (4 Bytes)
TCHAR szName[128]; // Seek 32 (128 Bytes)
TCHAR szGenre[64]; // Seek 160 (64 Bytes)
TCHAR szWeb[128]; // Seek 224 (128 Bytes)
};
ma in questo caso non potevo usare = per assegnare stringhe ai membri TCHAR...