Week 7- Random-Access Files and Secure Programming in C
Week 7- Random-Access Files and Secure Programming in C
COMPUTING II
• Every record has the same length so each record’s exact location relative to
the beginning of the file can be calculated as a function of the record key
• The following diagram shows one way to implement a random-access file
• Data can be inserted, updated or deleted without rewriting the entire file.
• #include <stdio.h>
• };
• int main(void)
• }
• }
• }
• }
• #include <stdio.h>
• struct clientData {
• };
• int main(void)
• {
• }
• else {
• scanf("%d", &client.acctNum);
• while (client.acctNum != 0) {
• client.firstName, &client.balance);
• fseek(cfPtr, (client.acctNum - 1) *
• scanf("%d", &client.acctNum);
• }
• }
• }