Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deciphering table header bytes 4-7
Message
From
19/11/2008 14:36:45
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01362880
Message ID:
01362909
Views:
7
>>The byte count is zero based, so the first byte is byte no. 0. I also found this link http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT
>
>Doh! I should have deduced that from the VFP documentation that gives a value for the byte offset 0! I must have left my brain in my other suit! :D
>
>Thanks again!!!
>
>Hugh

You're welcome. And I assure you that this happens to all of us from time to time, for me it happens more and more frequently. :-)


>>
>>>Thanks!!!!
>>>
>>>I knew it had to be something like that. However even had I gone in that direction I still would have been wrong. Because it looks from the MS code that they're working with bytes 5-8 not 4-7 (as specified in the VFP documentation).
>>>
>>>Am I reading the documetation or the code wrong?
>>>
>>>Hugh
>>>
>>>
>>>Help File - VFP Table File Structure
>>>Byte offset
>>>47        Number of records in file
>>>
>>>
>>>
>>>      lnHeaderByte8 = CHR(INT(lnCalcRecords / (256^3)))
>>>      lnHeaderByte7 = CHR(INT(lnCalcRecords / (256^2)))
>>>
>>>      lnHeaderByte6 = CHR(INT(lnCalcRecords / 256) - ;
>>>         IIF(lnCalcRecords / 256 > 256, ;
>>>             (INT(INT(lnCalcRecords / 256) / 256) * 256), ;
>>>             0))
>>>
>>>      lnHeaderByte5 = CHR(MOD(lnCalcRecords,256))
>>>
>>>
>>>
>>>
>>>>Check http://support.microsoft.com/kb/263902
>>>>
>>>>>Hi kids!
>>>>>
>>>>>I'm trying to figure out how to decipher table header bytes 4-7 (which according to the VFP help file) contains the number of records in the table file.
>>>>>
>>>>>Here's some data points:
>>>>>
>>>>>
>>>>>records      byte 4  5  6  7 
>>>>>-----------------------------
>>>>>      3           6- 3- 0- 0
>>>>>     40          22-40- 0- 0
>>>>>     18          11-18- 0- 0
>>>>> 217397          18-53-81- 3
>>>>>
>>>>>
>>>>>Here's the code I used:
>>>>>
>>>>>m.lcMyDBFFile = FILETOSTR("c:\whatever.dbf")
>>>>>
>>>>>m.lcString = TRANSFORM(ASC(SUBSTR(m.lcMyDBFFile,4,1))) + '-' ;
>>>>>				+ TRANSFORM(ASC(SUBSTR(m.lcMyDBFFile,5,1))) + '-' ;
>>>>>				+ TRANSFORM(ASC(SUBSTR(m.lcMyDBFFile,6,1))) + '-' ;
>>>>>				+ TRANSFORM(ASC(SUBSTR(m.lcMyDBFFile,7,1)))
>>>>>_cliptext = m.lcString
>>>>>
>>>>>
>>>>>Got any ideas??
>>>>>
>>>>>Hugh
Previous
Reply
Map
View

Click here to load this message in the networking platform