Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Spot the difference.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00431534
Message ID:
00431805
Vues:
12
Robin,

You can Try something like this:

lnDBFType=dbftype(yourtable)

do case
case lnDBFType=-2 && Invalid file name
case lnDBFType=-1 && Cannot open file
case lnDBFType=48 && VFP Table's first byte is 0x00000030
otherwise && There are different values for 2.6 tables
endif

function dbftype
parameters lcFileName
private lnFH, lcChar

* Should work with visual and 2.6

if type('lcFileName')#'C' or not file(lcFileName)
return -2
endif
lnFH=fopen(lcFileName)
if lnFH=-1
return -1
endif
lcChar=fgets(lnFH, 1)
=fclose(lnFH)
return asc(lcChar)

HTH
Hugo
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform