Category : C Source Code
Archive   : TC-DBF.ZIP
Filename : D_PUTFLD.C

 
Output of file : D_PUTFLD.C contained in archive : TC-DBF.ZIP
/*
** file: d_putfld.c
** purpose: routine to fill a field with data from buffer.
** ussage: d = (struct DBF *)malloc(sizeof(struct DBF));
** strcpy(d->filename,"filename.dbf");
** d_open(d);
** d_getrec(d,(long)recordno);
** d_getfld(d,fieldno,buffer);
** ... modify field data ...
** d_putfld(d,fieldno,buffer);
** d_putrec(d,(long)recordno);
** d_close(d);
** free(d);
** notes: compile with "tcc -c d_putfld". include this file in dbf.li
** see dbf.h for structure of DBF. this routine places the data into
** a record in memory. d_addrec or d_putrec must be called to write
** the data to the file on disk.
** returns: length of the field if successful. 0 if not.
** author: Mark Sadler
** revised: 6/14/87
*/

#include
#include
#include "dbf.h"

int d_putfld(struct DBF *d,int f,char *buff)
{
struct FIELD_RECORD *fp;

if(f > 0 && f <= d->num_fields)
{
fp = d->fields_ptr + (f - 1);
memcpy(fp->field_data_address,buff,fp->len);
return(fp->len);
}
else
{
return(0);
}
}



  3 Responses to “Category : C Source Code
Archive   : TC-DBF.ZIP
Filename : D_PUTFLD.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/