English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

example program to update a record or an algorithm of it

2007-08-12 17:23:42 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

typedef struct _contact
{
char ID[10];
char fname[20];
char sname[20];
} contact;

void update(FILE *fp, int recordPos, contact *record)
{
fseek(fp, recordPos * sizeof(contact, SEEK_SET);
fwrite((void *)record, sizeof(contact), 1, fp);
}


easy no?

2007-08-12 17:35:15 · answer #1 · answered by Anonymous · 0 1

It depends what type of record you're talking about?

Do you have a simplistic database like they teach in intro to C/C++ classes or are you working with a real database like SQL?

If the former, its simple -- you just find the record, make the change and write it to the file.

If you're using SQL you need to communicate with (or write your own) SQL driver to issue the appropriate command.

2007-08-12 17:36:34 · answer #2 · answered by mdigitale 7 · 1 0

SQL is used to update records in a table.

2007-08-12 17:27:48 · answer #3 · answered by Dr Cog 3 · 0 1

fedest.com, questions and answers