segread - Returns current values of segment registers in C

segread() Return Current Values of Segment Registers

#include <dos.h>

void segread(segregs);
struct SREGS *segregs; Segment register values

segread() sets the fields in '*segregs' to the current contents of
the segment registers. The segment registers are needed when using
the intdosx() and int86x() functions.

Returns: No return value, just sets 'segregs'.

Notes: Segment registers for 'far' pointers can be obtained with
the FP_SEG() macro.

#include <dos.h>             /* for segread() and struct SREGS */
#include <stdio.h>           /* for printf() */

struct SREGS segregs;

void main()
    printf("CS: %u  DS: %u  ES: %u  SS: %u\n", segregs.cs, segregs.ds,,;