I'm trying to read data from a dbase III file, and copy it to a newly created dbase III file.
I've got everything working, I am able to read all the data from the dbf file (such as version #, # of records, length of header...., descriptors...), but I'm facing a problem with reading the data from the actual records...
This is where I think the problem is originating from:
for(i=0; i < header.number_of_records; i++)
fread( &ch, 1, sizeof(ch), infile); // this
fwrite( &ch, 1, sizeof(ch), outfile);
if(ch == 0x20) /* the current record is valid (i.e, it is not deleted, there is no '*' before it) */
printf("\n\nRecord is valid\n");
if(ch == '*')
printf("\n\nRecord is deleted\n");
fread ( buffer,d[j].field_length,1, infile );
fwrite ( buffer,d[j].field_length,1, outfile );
i think the problem is with buffer (which is a char *)...maybe initialization issue....
This is what I'm getting:
It's giving me the value of the 1st field in the dbf file (there are two fields) + the path of where the program is actually running from....