Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a simple way to identify VFP tables?
Message
From
13/10/2003 09:45:51
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00838027
Message ID:
00838067
Views:
21
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform