#include "graphics.h" extern ostringstream bgiout; void outstream(ostringstream& out=bgiout); void outstreamsy(int x, int y, ostringstream& out=bgiout);
bgiout
. This output stream can be written to just
like cout
or any other output stream. However, the
information written to bgiout does not appear in the graphics window
until the program calls outstream
or
outstreamxy
.
The outstream
and outstreamxy
functions work
like outtext
and outtextxy
functions
except that they print from an ostringstream
rather than
from an ordinary string. The outstream
function prints
its information in the active graphics window at the current pointer.
The outstreamxy
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 the ostringstream
.
#include "graphics.h" initwindow(400, 400); bgiout << "Hello, World!" << endl; bgiout << 42 << endl; outstreamxy(100, 100); getch( ); closegraph( );