Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble with memo (FPT)
Message
From
23/10/1998 08:13:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149592
Message ID:
00149775
Views:
20
>Hi folks
>
>The VFP 6 documentation says that if a memo file is corrupt, you can replace the fpt file with another valid fpt file. The problem I'm having is that after replacing the fpt file,
>
>then packing the file
>then close the file
>then use the file again
>
>I get the VFP dialog to Repair a damaged memo file. Any help or ideas on how to completely replace the FPT file would be helpful.
>
>Here are the steps to reproduce the problem...
>
>create table mytable (name C(20), notes M, dob D)
>
>* now, manually add a few records
>
>* now make a copy of the table and zap it so to create an empty fpt file
>
>COPY TO mytable2
>USE && close the table
>
>USE mytable 2
>ZAP
>USE
>
>* In Windows Explorer, delete the mytable.fpt file. Rename
>* the mytable2.fpt to mytable.fpt
>
>* Now reopen the file, pack, close the file and open it
>
>USE mytable
>PACK
>USE
>USE mytable
>
>* At this point the repair dialog appears.
Peter,
Are you ready to completely get rid of fpt ? If so just changing byte offsett 28 in table header does it :
lparameters cTableName
handle=fopen(cTableName,12)
=fseek(handle,28)
nPokeByte = asc(fread(handle,1))
nWriteByte=bitand(nPokeByte,0xFD) && 11111101 - Clear has memo
=fseek(handle,28)
=fwrite(handle,chr(nWriteByte))
=fclose(handle)
If you want you can corparate the changing of field types from M to C in routine. To do this all visually&manually you can execute :
do form (home()+"tools\hexedit\hexedit") with mytable.dbf
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform