Hi folks.
Anyone into offsetof definition?
I found this in the Dummie bok, it was a nice exsample on a struct with
2 fields.
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
The problem is that I have tree fields... so, can I use this.? I'm not
into math u know.
This is my struct:
typedef struct{
char field1[20];
char filed2[14];
char field3[14];
}dbRecord;
The real question is how do I use it?
dtScan = FldGetTextPtr(GetObjectPtr(EditScanField));
ups = FldGetTextPtr(GetObjectPtr(EditUpsField));
tagg = FldGetTextPtr(GetObjectPtr(EditTaggField));
nyrecordH = DmNewHandle(gDB, packedRecordSize);
nyScanrecord = MemHandleLock(nyrecordH);
DmWrite(nyScanrecord, 0, dtScan, 20);
DmWrite(nyScanrecord, 20, ups, 14);
DmWrite(nyScanrecord, offsetof(dbRecord, tagg),14); // Got undefine
identifier size_t
prefs.editPinNo = DmFindSortPosition(gDB, nyScanrecord, 0,
(DmComparF *) CompareRecords, 0);
DmAttachRecord (gDB, &prefs.editPinNo, (Handle) newRecordHandle, NULL);
Have tried to use : DmWrite(gDB, nyScanrecord, 0, &dbRecord,
sizeof(dbRecord));
but this didn't work.
Thanks for all help
Paal.
--
-Nortrade Electronic AS
-Kirkeveien 25 B
-1363 Hoevik, Norway
Tlf: +47 67591124
Fax: +47 67581843