I have been given an assignment in persistent data(Language C), basically i had to be able to search for a customer or a sale which i think i have done, and convert that text file to a binary file. Now im just wondering how to add a sale or customer to the file.. Any help would be apreciated or comments on my code so far because im a bit rusty with it..
printf("Please enter\n1. to search a customer or sale\n2. to add a customer\n3. to add a sale\n4. binary search\n");
scanf("%5d", &num1, &num2, &num3, &num4);
if ( fpcust == NULL)
{
printf("File cound not be opened.");
exit(0);
}
else
{
len_string = strlen(searchID);
while (!feof ( fpcust ) )
{
for (i = 0; i < len_string; i++)
{
temp[i] = fgetc ( fpcust );
}
temp[i] = '\0';
//strcmp used for comparing both strings
if ( strcmp ( searchID, temp ) == 0)
{
printf("The ID was found \n");
fclose( fpcust);
system ("PAUSE");
exit(1);
}