Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>fp_seg() get or set segment portion of a far pointer (macro)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FP_SEG()                Get or Set Segment Portion of a Far Pointer (Macro)

 #include   <dos.h>

 unsigned   FP_SEG(longptr);
 void far   *longptr;                    Long pointer to memory address

    FP_SEG() gets or sets the segment portion of the far pointer
    'longptr'.

       Returns:     An unsigned integer representing a segment address.

         Notes:     FP_SEG() is a macro.

   Portability:     MS-DOS only.

   -------------------------------- Example ---------------------------------

    The following example gets the segment and offset portion of a far
    pointer and increments the offset by one.

           #include <dos.h>

           char far *ptr;
           unsigned int seg_val, off_val;

           main()
           {
               seg_val = FP_SEG(ptr);
               off_val = FP_OFF(ptr);
               FP_OFF(ptr) = ++off_val;
               printf("%04x:%04x",seg_val,off_val);
           }


See Also: FP_OFF()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson