This function saves the pixels of a screen display into a file.

Syntax

int SaveDisplay(
  char *filename
);

Parameters

filename
[in] Points to a string containing the name of a file into which a screen display will be stored.

Return value

Returns the OK or ERROR of the function.
ValueDescription
OK Opened the file and saved the contents of the screen display.
ERROR Could not open or write the file.

Remarks

When the file cannot be opened or written to an error will be returned. The saved screen can later be restored with the function LoadDisplay function.
This function is useful when implementing help screens after which the original screen must be restored

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"
void main(void)
{
    printf("[SaveDisplay]\n");
    printf("Please any key\r");
    ResetKey();
    while(!kbhit())
        Idle();
    printf("\fThis is screen\nnumber ONE.");
    SaveDisplay("screen1.dat");
    Delay(100);
    printf("\fThis is screen\nnumber TWO.");
    SaveDisplay("screen2.dat");
    printf("\fPlease any key\r");
    ResetKey();
    while (!kbhit())
        Idle();
    LoadDisplay("screen1.dat");
    printf("Please any key\r");
    ResetKey();
    while (!kbhit())
        Idle();
    LoadDisplay("screen2.dat");
    printf("Please any key\r");
    ResetKey();
    while (!kbhit())
        Idle();
}

Last updated: 2020/10/02