home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power CD-ROM!! 7
/
POWERCD7.ISO
/
prgmming
/
clipper
/
gt_memsa.prg
< prev
next >
Wrap
Text File
|
1993-10-14
|
3KB
|
120 lines
/*
File......: GT_MemSave.prg
Author....: Martin Bryant
BBS.......: The Dark Knight Returns
Net/Node..: 050/069
User Name.: Martin Bryant
Date......: 04/02/93
Revision..: 1.0
This is an original work by Martin Bryant and is placed
in the public domain.
Modification history:
---------------------
Rev 1.0 04/02/93
PD Revision.
*/
/* $DOC$
* $FUNCNAME$
* GT_MEMSAVE()
* $CATEGORY$
* File I/O
* $ONELINER$
* To save variables to a .mem file
* $SYNTAX$
* GT_MemSave(<cFile>,<cFilter>,[<nSeconds>],<nPause>]) => lSuccess
* $ARGUMENTS$
* <cFile> is the name, including path and extention,
* of the file to save to.
*
* <cFilter> is the specification of the variables to
* save.
*
* <nSeconds> is the time to wait.
*
* <nPause> is the time interval between attempts.
* $RETURNS$
* .T. / .F.
* $DESCRIPTION$
* To save variables to a .mem file
* $EXAMPLES$
* IF .NOT. GT_MemSave('System.mem','p*')
* ? 'Error'
* ENDIF
* $SEEALSO$
*
* $INCLUDE$
*
* $END$
*/
#include "GT_LIB.ch"
#define HEIGHT 06
#define WIDTH 16
FUNCTION GT_MemSave(cFile,cFilter,nSeconds,nPause)
Local cScreen := ''
LOCAL nBottom := INT((MAXROW() + HEIGHT)/2)
LOCAL nKey := 0
LOCAL nLeft := INT((MAXCOL() - WIDTH)/2)
LOCAL nRight := nLeft - WIDTH
LOCAL nTop := nBottom - HEIGHT
Local lMessage := .F.
Local lSuccess := .F.
Default cFile to 'System.mem'
Default cFilter to '*'
Default nSeconds to 120
Default nPause to 0.5
DO WHILE (.NOT. lSuccess) .AND. (nSeconds > 0) .AND. ;
(nKey != K_ESC)
// Save ?
SAVE ALL LIKE (cFilter) TO (cFile)
lSuccess := (FERROR() == 0)
IF .NOT. lSuccess
// Wait and retry
IF .NOT. lMessage
// Save
cScreen := SAVESCREEN(nTop,nLeft,nBottom,nRight)
// Display
GT_Window(nTop,nLeft,nBottom,nRight,BOX_SS, ;
NIL,'Saving ....',.T.)
// Position for message
@ nTop+02, nLeft+02 SAY 'Timeout:'
@ nTop+04, nLeft+02 SAY ;
PADC('Esc∙Exit',WIDTH-03)
lMessage := .T.
ENDIF
@ nTop+02, nLeft+09 SAY PADR(INT(nSeconds),3)
nKey := INKEY(nPause)
nSeconds -= nPause
ENDIF
ENDDO
IF lMessage
RESTSCREEN(nTop,nLeft,nBottom,nRight,cScreen)
ENDIF
/*
End of GT_MemSave()
*/
RETURN(lSuccess)