Hi Tom,
Yes, but Harbour is Clipper, not (a recent) dBase or FoxPro workalike.
And Clipper must be able to understand files created by Harbour. So try
this page instead:
http://www.zelczak.com/clipp_en.htm
At the time when the first dBase clones were created, Asthon Tate had
not quite realized that European countries were not satisfied with just
7-bit US-ASCII, so there was not yet a standard for codepages. And
Nantucket came up with their own system that the Clipper clones follow.
> I have to create DBF to share with users who have a software created
> with VisualFoxPro, which generates DBF who also writes the byte 29,
> and which has a command that analyzes this byte.
Well, you forgot to mention that you needed a FoxPro solution.
> So, from what you say, the only way to set the bytes 29 is to write it
> directly, because there is no command Harbour that does it.
> Right?
Yes, a simple fopen(); fseek(); fwrite(); fclose() sequence will do it.
You can even write your own FoxDbCreate() function that wraps DbCreate()
(without the <lKeepOpen> flag) and runs the fopen() ... sequence after
creating it.
But I do not know if that will help or not. I suspect (although I am no
FoxPro user) that FoxPro might be expecting the rest of the extended
header for the codepage setting to work, so this is what might happen:
Harbour creates a dBaseIII/Clipper dbf file with the short
dBaseIII/Clipper header and sets the file type byte to dBase III. You
add the codepage flag in byte 29, but FoxPro ignores it because that
flag is not a part of the dBaseIII file format standard. The solution is
probably to do it the other way around.
There is one thing you can try, though. The file type byte, the very
first byte of the dbf file, is 03h for a dBaseIII/Clipper dbf with no
memo fields. A basic VFP file type byte is 30h. If you call
hb_rddinfo(RDDI_TABLETYPE,DB_DBF_VFP) before creating the dbf file, and
#include "
dbinfo.ch" at the top of the source file, then a dbf file with
a 30h file type will be created (with a short header). But I don't know
if that is enough for FoxPro to recognize the codepage byte. Try it and
see what happens. Either way, in Harbour you will have to specify the
codepage in the source code.
And one more thing. As I said last time, if you share the dbf between
Harbour and any other xBase version it is an absolute must that you use
a codepage that is 100% compatible with that other xBase version. Use
the cpinfo.prg utility in the harbour\tests directory to compare your
chosen codepage with what the other xBase version creates. It is written
for Harbour and Clipper, so you may have to modify it, change some
function names for example, for Fox. If the match is not absolute, your
applications *will* blow up with index corruption.
Good luck :-)
Regards,
Klas