Function name: Open
Function: Open a file for reading or writing
Usage: int open (char * pathname, int access [, int permiss);
Example:
#include
#include
#include
#include
Int main (void)
{
INT HANDLE;
CHAR MSG [] = "Hello World";
IF ("Test. $$$", O_CREAT | O_TEXT)) == -1)
{
PERROR ("Error:");
Return 1;
}
Write (Handle, MSG, Strlen (MSG));
Close (Handle);
Return 0;
}
Function name: OUTPORT
Function: Output integers into the hardware port
Usage: Void Outport (int port, int value);
Example:
#include
#include
Int main (void)
{
INT value = 64;
INT port = 0;
OUTPORTB (Port, Value);
Printf ("Value% D Sent To Port Number% D / N", Value, Port);
Return 0;
}
Function name: Outportb
Function: Output bytes into the hardware port
Usage: Void Outportb (Int port, char Byte);
Example:
#include
#include
Int main (void)
{
INT value = 64;
INT port = 0;
OUTPORTB (Port, Value);
Printf ("Value% D Sent To Port Number% D / N", Value, Port);
Return 0;
}
Function name: OutText
Function: Display a string in the viewpoint
Usage: Void Far Outtext (Char Far * TextString);
Example:
#include
#include
#include
#include
Int main (void)
{
/ * Request Auto Detection * /
INT GDRIVER = Detect, Gmode, ERRORCODE
Int midx, midy;
/ * Initialize Graphics and Local Variables * /
INITGRAPH (& GDriver, & gmode, ");
/ * Read Result of Initization * /
ErrorCode = graphresult ();
IF (ErrorCode! = GROK) / * an error occurred * /
{
Printf ("Graphics Error:% S / N", GrapherrorMsg (ErrorCode));
Printf ("Press Any Key to Halt:");
Getch ();
EXIT (1); / * Terminate with an error code * /
}
MIDX = getmaxx () / 2; Midy = getMaxy () / 2;
/ * Move the c.p. to the center of the screen * /
Moveto (MIDX, MIDY);
/ * Output text starting at the c.p. * /
OutText ("this");
OutText ("IS");
OutText ("a");
OutText ("Test.");
/ * Clean Up * /
Getch ();
Closegraph ();
Return 0;
}
Function name: OutTextxy
Function: Display a string at the specified location
Usage: Void Far Outtextxy (int X, int y, char * textstring);
Example:
#include
#include
#include
#include
Int main (void)
{
/ * Request Auto Detection * /
INT GDRIVER = Detect, Gmode, ERRORCODE
Int midx, midy;
/ * Initialize Graphics and Local Variables * /
INITGRAPH (& GDriver, & gmode, ");
/ * Read Result of Initization * /
ErrorCode = graphresult ();
IF (ErrorCode! = GROK) / * an error occurred * /
{
Printf ("Graphics Error:% S / N", GrapherrorMsg (ErrorCode));
Printf ("Press Any Key to Halt:");
Getch ();
EXIT (1); / * Terminate with an error code * /
}
MIDX = getmaxx () / 2;
Midy = getmaxy () / 2;
/ * OUTPUT TEXT At the Center of the screen * /
/ * Note: The c.p. doesn't get change. * /
Outtextxy (MIDX, Midy, "this is a test.");
/ * Clean Up * /
Getch ();
Closegraph ();
Return 0;
}