>Hi All,
>
>I am looking for a simple way to identify VFP tables. My app can come across several different types such as dBase2 and I want only to be able to open the VFP ones. When I look at the table stru in help I see that first byte is x'30' for VFP. What is the best way to check this from inside of VFP? Any assistance would be most appreciated.
>
>Regards Rex
The solution is LLFF. Here is a sample (untested) to get the first byte of a file:
function FirstByte
lparameters tcFileName
local lnFile, lcFirstByte
lnFile = fopen(tcFileName)
if lnFile < 0
MessageBox("Can't open file " + tcFileName)
return NULL
endif
lcFirstByte = fread(lnFile, 1)
fclose(lnFile)
return lcFirstByte
You can use asc() to convert it to a numeric value (decimal).
HTH,
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)