Now let us see an example of the function intdosx. The following example shows the use of intdosx function. The program outputs a string to the standard output.
/* The program to output 'string' to the standard output. */
#include <dos.h>
union REGS inregs, outregs;
struct SREGS segregs;
char far *string = "this string is not in the
default data segment$";
void main()
{
inregs.h.ah = 0x09; /* function number */
inregs.x.dx = FP_OFF(string);/*DS:DX is far
address of 'string */
segregs.ds = FP_SEG(string);
intdosx(&inregs, &outregs, &segregs);
getch();
}
And the output of the program will be as follows:
this string is not in the default data segment |
Here we are printing the given string with the function intdosx, by function 09H of INT 21H. It should always be kept in mind that the given string should always end with the character “$”.
|