this is the code i have to open the following text file:
FILE * fp;
fp = fopen ("student.txt", "r");
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?
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
The text file is stored on my M drive. When the user executes the
program, they are presented with a Menu allowing them to specify to show:
All records would display the above file to the user and the above code
The problem I am finding is how can i implement the code so that the user
can specify to show only the first record or last record or previous
record and the next record.
How can the user sort the records in chronological order(the 3rd field in
Can you provide me with any help or point me in the right direction?
Well, compared to your code that reads the characters and prints them on
the screen and all the program is fourteen lines, you need a few hundred
lines of code to do what you desire.
So specifically to say:
>how can i implement the code so that the user can
you have to program it. For that you have to learn programming. I suggest
that first you target smaller issues and in a half year of study you will
be able to solve the issue you targeting right now.
[ back to toc ]