Thanks for everybody.
I started coding the main function, and i found a lot of difficulties in this. and here's the code.
Code:
#include <stdio.h>
// The Maximum Length of BookName is 100 Characters
#define MAXL_BOOKNAME 100
// The Maximum Length of BookAuthor is 50 Characters
#define MAXL_BOOKAUTHOR 50
// The Maximum Length of DATE is 20 Characters
#define MAXL_DATE
// Defining a struct (Mostly Quoted from Hammer)
typedef struct BookRecord
{
int Book_Id;
char Book_Name[MAXL_BOOKNAME];
char Book_Author[MAXL_BOOKAUTHOR];
char Book_PublishingDate[MAXL_DATE];
/* we can use "time_t Book_PublishingDate; */
// return true if the Book is borrowed Is it correct?
bool Book_Borrowed;
} BookRecord_t; // Why using _t ? (Hammer's Code)
void main()
{
char value;
int val;
printf("What Do you Want to do: ");
printf("\n1. Encrypt The File.");
printf("\n2. Decrypt The file.");
printf("\n3. Add a new Book.");
printf("\n4. Remove an Existing Book.");
printf("\n5. Update an Existing Book.");
printf("\n6. Exit Program.\n");
val=Integer.parseInt(value); // Error here! how to change char to integer
// in c?
scanf(value, "%d"); // is this statement true to input a value?
switch val {
case 1:
// What functions to include here?
break;
case 2:
// What functions to include here?
case 3:
AddRecord() // What parameters to include?
case 4:
RemoveRecord(RecordNum) // I'm not sure about the parameters
case 5:
UpdateRecord(RecordNum) // also i'm not ....
case 6:
exit(); // Can I use this exit function that do exist in stdlib (as
// stumon said?)
}
I included the questions and i'll be thankful if you can answer any, or add new suggestions, and here are the previous questions that still nobody answered :
1. can I use a global list? (i.e. can encryption/decryption work for global?)
2. Another question arose here since i should use variable length record as Mr. Rog said : While Updating a Record, what will happen if the new record is longer than the old one?
3. What happens If I want to delete a name in a record? (i.e. can i remove or update only one field in a record?)
4. how i can declare a primary key in C or C++?
Waiting for Replies,