title: Deleting infomation from a binary file
body: <p>Hello my problem is the following;</p>
  
  <p>i have this struct</p>
  
  <pre><code>struct item{
      char id[5];
      int ing[10];
      float qtd[10];
  };
  </code></pre>
  
  <p>and i have a binary file with information, and i want to delete a selected id, i tryed this</p>
  
  <pre><code>int remove(){   
      FILE *origem;
      FILE *copia;
      char menu[10];
      struct item aux;
      origem=fopen("menu.bin","rb");
      copia=fopen("temp.bin","wb");
      if(origem==NULL || copia==NULL)
          return;
  
      do{
  
          printf("name to delete");
          scanf("%s",&amp;menu);
  
          if(stricmp(menu,aux.id)!=0)
              fwrite(&amp;aux,sizeof(aux),1,copia);
  
      }while(fread(&amp;aux,sizeof(aux),1,origem)==1);
  
      fclose(origem);
      fclose(copia);
      remove("menu.bin");
      rename("temp.bin","menu.bin");
  
  }
  </code></pre>
  
  <p>can you help me? 
  i want to copy the cotents except the ID i choose.
  thanks in advance.</p>