[ back to toc ]

a simple database

Date: 2002/04/25 13:00

Q:
hi

this is the code i have to open the following text file:

*NAME-DELETED*ima,hoque,99133653,19-06-80
rachael,milor,99159357,29-05-81
carl,palmer,00214356,29-09-80
aaron,bimpson,01552336,11-02-80
louise,irving,00258654,25-03-81
helen,eckert,00214953,05-07-79
marion,laverty,98885361,25-05-78
chris,evans,99543682,04-02-80
noah,fa*NAME-DELETED*,99542364,15-10-78
lynsay,carmen,01258632,16/12/82

CODE:

#include <stdio.h>
int main()

{
FILE * fp;
int c;
fp = fopen ("student.txt", "r");
while (feof(fp)==0)
{
c=fgetc (fp);
putchar (c);
}
fclose (fp);
getchar();
}

this code works correctly. How would i allow the user to be able to
specify the first record, last record, previous record and next record?

Thank you

Rah
A:
You can compile this code to standalone executable and process the command
line arguments using the argument variables to the function 'main' called
argc, and argv. The arguments could specify the record number.

However I am afraid that this is not the asnwer for the question you
wanted to ask. I suggest that you try be more precise asking your
question.

Regards,
Peter

[ back to toc ]