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 likecoutor any other output stream. However, the information written to bgiout does not appear in the graphics window until the program callsoutstreamoroutstreamxy.The
outstreamandoutstreamxyfunctions work likeouttextandouttextxyfunctions except that they print from anostringstreamrather than from an ordinary string. Theoutstreamfunction prints its information in the active graphics window at the current pointer. Theoutstreamxyfunction 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
bgioutas 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( );
