far pointers?! Are you by any chance using Turbo C?
(if so, use the MK_FP macro)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
I'm using Turbo C++ 3.0, and i know it has pokeb and mk_fp. but i want to make my own includes.
I tested using ptr[0] or ptr instead of *ptr but it doesn't work...
I've seen that many people use: ptr = (char far *)(segment << 16) | offset);
but i don't understand why they use << 16 (to multiply the segment by 16 its possible to use segment << 4) and i don't understand why the use |...
I don't have TC3 installed anymore, so I can't check. But it seems that if you cast a 32-bit int into a far pointer it will split it for you into a seg:off pair (2x16 bits = 32 bits)
Nevertheless, pokeb, MK_FP etc, are TC-specific macros (and are portable), so there's no need to reinvent the wheel when its given to you on a silver plate.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]