_segread

Description

Gets the current values of segment registers.

#include <dos.h>

void _segread( struct _SREGS *segregs );

segregs Segment-register values  

Remarks

The _segread function fills the structure pointed to by segregs with the current contents of the segment registers. The _SREGS union is described in the reference section for _int86x. This function is intended to be used with the _intdosx and _int86x functions to retrieve segment-register values for later use.

Return Value

None.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

_FP_SEG, _intdosx, _int86x

Example

/* SEGREAD.C: This program gets the current segment values with _segread. */

#include <dos.h>

#include <stdio.h>

void main( void )

{

struct _SREGS segregs;

unsigned cs, ds, es, ss;

/* Read the segment register values */

_segread( &segregs );

cs = segregs.cs;

ds = segregs.ds;

es = segregs.es;

ss = segregs.ss;

printf( "CS = 0x%.4x DS = 0x%.4x ES = 0x%.4x SS = 0x%.4x\n",

cs, ds, es, ss );

}

Output

CS = 0x0047 DS = 0x0067 ES = 0x0067 SS = 0x0067

CS = 0x2bcc DS = 0x2ce8 ES = 0x2ba3 SS = 0x2ce8