Output Stream Functions for Windows BGI
- Syntax
-
#include "graphics.h" extern ostringstream bgiout; void outstream(ostringstream& out=bgiout); void outstreamsy(int x, int y, ostringstream& out=bgiout);
- Description
-
The winbgim package supports a globally defined output stream
called
bgiout
. This output stream can be written to just likecout
or any other output stream. However, the information written to bgiout does not appear in the graphics window until the program callsoutstream
oroutstreamxy
.The
outstream
andoutstreamxy
functions work likeouttext
andouttextxy
functions except that they print from anostringstream
rather than from an ordinary string. Theoutstream
function prints its information in the active graphics window at the current pointer. Theoutstreamxy
function prints its information in the active graphics window at coordinates (x,y).Both functions clear the ostreamstream after printing its information.
Both functions use the global
bgiout
as the default value for theostringstream
. - bgiout Examples:
-
#include "graphics.h" initwindow(400, 400); bgiout << "Hello, World!" << endl; bgiout << 42 << endl; outstreamxy(100, 100); getch( ); closegraph( );