lines.c

来自「Intro/: Directory containing introducto」· C语言 代码 · 共 35 行

C
35
字号
#include <phigs.h>			/* get HP-PHIGS definitions for C */#include <stdio.h>			/* get standard I/O definitions */main()					/* file "Lines.c" */{    Pint	WorkstnID = 1;		/* workstation identifier */    Pint	ConnID;			/* connection identifier */    Pint	WorkstnType = POIDDX;	/* out/in, direct, dbl bfr, Xwindow */    Pint	TheCurve = 1;		/* structure ID (chosen by user) */    Ppoint	LinePts[100];		/* points for the polyline */    Ppoint_list	LineData;		/* data for the polyline */    FILE	*datafile;		/* file pointer */    int		I = 0;			/* loop control variable */    /*=== read data file into the structure array ==========================*/    datafile = fopen("data", "r");	/* open data file (2 numbers/line) */    while (fscanf(datafile, "%f%f", &LinePts[I].x, &LinePts[I].y) != EOF)	I++;    fclose(datafile);    LineData.num_points = I;    LineData.points = LinePts;    /*=== set up HP-PHIGS to plot data =====================================*/    popen_phigs((char *) stderr, 0);	/* errors go to "stderr" */    pescape_u4("/dev/screen/phigs_window", &ConnID);    popen_ws(WorkstnID, (void *) ConnID, WorkstnType);    popen_struct(TheCurve);    ppolyline(&LineData);    pclose_struct();    /*=== post the image and close up shop =================================*/    ppost_struct(WorkstnID, TheCurve, 1.0);    pupd_ws(WorkstnID, PFLAG_PERFORM);	/* (regeneration flag) */    pclose_ws(WorkstnID);    pclose_phigs();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?