Category : Files from Magazines
Archive   : DBMS9104.ZIP
Filename : TECHTIP2.APR

 
Output of file : TECHTIP2.APR contained in archive : DBMS9104.ZIP

LISTING 2

/***
*
* INSERT A CONTROL-Z AT EOFO
*
***/

** test.prg

if add_eof(ÒGLENTRY.TXTÓ)
use getdata
append from (ÒGLENTRY.TXTÓ) SDF
else
error(ÒThere has been a problem adding an EOF to GLENTRY.TXTÓ)
RETURN
endif

#include ÒFileio.chÓ

FUNCTION add_eof (filename)
local error

error := ( fhandle := FOPEN(filename,FO_READWRITE) ) <= 0

FSEEK(fhandle,1,FS_END)
error = error .OR. FERROR() <> 0

error = error .OR. (FWRITE(fhandle,chr(26),1) <> 1)

FCLOSE(fhandle)

RETURN error .OR. FERROR() <> 0