Hi Philipp,
first of all thanks for that fantastic peace of code to Kirk, very nice job and a great distribution to the new IT world, it really is almost perfect. I encounted that if one field is set to autoindex ( auto incremented ) it does not get through this check:
332 if(dbfheader.signature == 0x30) {
333 /* Certain Visual FoxPro files have an (empty?) 263-byte buffer
334 * after the header information. Take that into account when
335 * calculating field counts and possibly seeking over it later. */
336 skipbytes = 263;
337 } else {
338 skipbytes = 0;
339 }
because the signature code would be 0x31 ( same goes for 0x32 ) a old VisualFoxPro expert told me, so I ran a little test by changing that line 332 to, because in both
cases the length would be the same and can be handled the same
332 if((dbfheader.signature == 0x30) || (dbfheader.signature == 0x31) || (dbfheader.signature == 0x32)) {
333 /* Certain Visual FoxPro files have an (empty?) 263-byte buffer
334 * after the header information. Take that into account when
335 * calculating field counts and possibly seeking over it later. */
336 skipbytes = 263;
337 } else {
338 skipbytes = 0;
339 }
On the next try after compliing I figured out that it was not an issue to import autoindexed ( auto incremented ) files anymore, and after checking it turned out that all data converted was valid too.
So I went on and checked the next part since I encountered that I could not import dbf files that had Varchar fields in it. So I ran through the code again and found this:
538 case 'C':
539 if(optusecreatetable) printf("VARCHAR(%d)", fields[fieldnum].length);
540 break;
541 case 'D':
since the field type Varchar is simulated in VisualFoxPro by a Character field, I just added this case condition:
538 case 'C':
539 case 'V':
540 if(optusecreatetable) printf("VARCHAR(%d)", fields[fieldnum].length);
541 break;
My request, do those changes make sense, and can I keep them like this, will they be added ( which would be really nice )?
Thanks,
Stephan