#include <tscope.h>
void function_a()
{
int oldcolor;
oldcolor = ts_fgcolor(RED);
ts_printf_centre(0, 80, "function A prints in red");
ts_printf_centre(0, 60, "and restores the old color value");
ts_fgcolor(oldcolor);
}
void function_b()
{
ts_fgcolor(BLUE);
ts_printf_centre(0, 80, "function B prints in blue");
ts_printf_centre(0, 60, "and doesn't restore the old color value");
}
int main()
{
ts_init();
ts_printf_centre(0, 100, "default, text is white");
function_a();
ts_printf_centre(0, 40, "function A has no influence on the");
ts_printf_centre(0, 20, "text/drawing done by other functions");
ts_button(XMAX - 20, -YMAX + 20);
ts_clrscr();
ts_printf_centre(0, 100, "default, text is white");
function_b();
ts_printf_centre(0, 40, "all subsequent text/drawing");
ts_printf_centre(0, 20, "will have function B's color");
ts_button(XMAX - 20, -YMAX + 20);
return 0;
}
END_OF_MAIN();