getx
raw OCR
Returns the current graphics position's x-coordinate.
Defined in header <graphics.h>
Syntax
#include <graphics.h>
int far getx(void);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
getx finds the current graphics position's x-coordinate. The value is viewport-relative.
Return value
getx returns the x-coordinate of the current position.
See also
Example
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
Hnclude <conio.h>
int main(void)
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
char ]nsg[80] ;
/* initialize graphics and local variables */
initgraph(&gdriver, &ginode, "");
/* read result of initialization */
errorcode = graphresult ();
if (errorcode != grOk) { /* an error occurred */
printf("Graphics error: %s\n", grapherrormsg(errorcode) );
printf("Press any key to halt:");
getchO ;
exit(l); /* terminate with an error code */
■ }
/* move to the screen center point */
moveto(getmaxx 0 / 2, getmaxy () / 2);
/* create a message string */
sprintf(msg, "<-(%d, %d) is the here.' getxO, gety(
/* display the message */
outtext(msg);
/* clean up */
getchO ;
closegraph(
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/graphics.h/getx/
· short form /3.1/getx/