Convert Harbour numeric into signed short encoded bytes
// Update DBF "last update" date
#include "fileio.ch"
FUNCTION main()
LOCAL nHandle, cYear, cMonth, cDay
use test
? "Original update date is:", lupdate()
close
nHandle := fopen( "test.dbf", FO_READWRITE )
IF nHandle > 0
fseek( nHandle, 1, )
cYear := I2BIN( 68 )
cMonth := I2BIN( 8 )
cDay := I2BIN( 1 )
fwrite( nHandle, cYear , 1 ) // write only the first byte
fwrite( nHandle, cMonth, 1 )
fwrite( nHandle, cDay , 1 )
fclose( nHandle )
use test
? "New update date is:", lupdate()
close
ELSE
? "Can not open file"
ENDIF
RETURN NIL