Hi,
now i have work on it for a long time it is working but,
when it can not find the item any how it will print item not found + item found , i have no idea what is wrong any help welcome,
thanks

....
...
..


    if( (strcmp(s->Aname,nAname)==0) && (strcmp(s->Oname,nOname)==0) )

		flag=1;
		if(flag==0)
		{
			printf("*********************************************************************\n");
			printf("*******************  can not find item   ********************\n");
			printf("*********************************************************************\n\n\n");

    
		}

   rewind(fp);

   fflush(stdin);

   while( fread(s,recsize,1,fp) == 1)

   {
    if( (strcmp(s->Aname,nAname) != 0) || (strcmp(s->Oname,nOname) != 0) )

      fwrite(s,recsize,1,ft);
   }

   if(flag == 1)

	printf("*********************************************************************\n");
	printf("*******************  item found  ********************\n");
	printf("*********************************************************************\n");

	fclose(fp);
	fclose(ft);
	remove("autotiedot.bin");
	rename("temp.dat","autotiedot.bin");
	fp=fopen("autotiedot.bin","rb++");
   


	fclose(fp);

Hello,
I saw ur code but not getting what u exactly want to do. I am not getting the variables if possible send the whole code so that i will help u

your code is missing parentheses. Without parentheses, only the first line after the if statement belongs to the condition, all other lines will be executed regardless of the if condition.

if(flag == 1)
  {
	printf("*********************************************************************\n");
	printf("*******************  item found  ********************\n");
	printf("*********************************************************************\n");
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.