lineto
raw OCR
Draws a line from the current position (CP) to {x,y).
Defined in header <graphics.h>
Syntax
#include <graphics.h>
void far lineto(int x, int y);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
lineto draws a line from the CP to {x,y), then moves the CP to (x,i/).
Return value
None.
See also
Example
#include <graphics.h>
Jinclude <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
char msg[80];
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) {
printf("Graphics error: %s\n", grapherrormsg(errorcode)
printf("Press any key to halt:");
getchO ;
exit(l);
/* move the CP to location (20,30) */
moveto(20, 30);
/* create and output a message at (20,30) */
sprintf(msg, " (%d, %d)", getx(), getyO);
outtextxy (20,30, nisg);
/* draw a line to (1(),100) V
linetodOO, 100);
/* create and output a message at CP */
sprintf(msg, " (%d, %d)", getx(), getyO
outtext(msg);
/* clean up */
getchO ; '
closegraphO ;
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/lineto/
· short form /3.1/lineto/