Category : Recently Uploaded Files
Archive   : SNPD9503.ZIP
Filename : SCRNSAVE.C

 
Output of file : SCRNSAVE.C contained in archive : SNPD9503.ZIP
.I 0 8
/*
** Portable PC screen functions
** Public domain by Bob Stout
** Uses VIDPORT.C, also from SNIPPETS
** Uses _fmemcpy(), available in most PC compiler libraries
** A portable _fmemcpy() is available in FMEMOPS.C, also from SNIPPETS
*/

.D 1 6
.I 7 11
#include "scrnmacs.h" /* Also in SNIPPETS */

/*
** Save the text screen
*/

struct SCREEN *SaveScrn(void)
{
struct SCREEN *screen;

if (NULL == (screen = malloc(sizeof(struct SCREEN))))
.D 8 26
.I 34 28
if (NULL == (screen->vbuf = malloc(SCRNBYTES)))
{
free(screen);
return NULL;
}
_fmemcpy((unsigned short FAR *)(screen->vbuf), SCRBUFF, SCRNBYTES);
GetCurPos(&screen->curX, &screen->curY);
return screen;
}

/*
** Restore the text screen
*/

void RestoreScrn(struct SCREEN *screen)
{
_fmemcpy(SCRBUFF, (unsigned short FAR *)(screen->vbuf), SCRNBYTES);
GotoXY(screen->curX, screen->curY);
}

/*
** Free a saved screen buffer
*/

void FreeScrnBuf(struct SCREEN *screen)
{
free(screen->vbuf);
free(screen);
.D 35 2
.D 39 16
.I 60 24
/*
** Run this test with a screenful of misc. stuff
*/

main()
{
struct SCREEN *screen;
int vatr = GetCurAtr();

if (NULL == (screen = SaveScrn()))
{
puts("Unable to save the screen");
return 1;
}
ClrScrn(vatr);
GotoXY(0, 0);
fputs("ClrScrn() tested", stderr);
fputs("\nHit any key to continue...\n", stderr);
getch();
RestoreScrn(screen);
FreeScrnBuf(screen);
}

#endif
.D 61 19


  3 Responses to “Category : Recently Uploaded Files
Archive   : SNPD9503.ZIP
Filename : SCRNSAVE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/