lnH = FOPEN("c:\TestFolder\"+ inspctn.ciulkey + "_2.doc")
IF lnH < 0
*-- Error opening file
ENDIF
lcHdr = FREAD(lnH, 3) && You may read more bytes...
=FCLOSE(lnH)
DO CASE
CASE ASC(lcHdr) = 0xD0 AND ASC(SUBSTR(lcHdr, 2, 1)) = 0xCF AND ASC(SUBSTR(lcHdr, 3, 1)) = 0x11
*-- Word .DOC file
CASE ASC(lcHdr) = 0xFF AND ASC(SUBSTR(lcHdr, 2, 1)) = 0x57 AND ASC(SUBSTR(lcHdr, 3, 1)) = 0x50 AND ASC(SUBSTR(lcHdr, 2, 1)) = 0x43
*-- WordPerfect file
OTHERWISE
*-- Unknown file
ENDCASE
|