#include "my.h"
void nameSort(){
 FILE *f;
 int n=1,i,l,k=0;
 char a[51];
 char b[51];
 f=fopen("binarydata","rb+");
 while(n==1){
  n=0;
  fseek(f,0,SEEK_SET);
  while(!feof(f)){
   fread(a,1,51,f);
   fread(b,1,51,f);
   if(feof(f))
    break;
   if((strcmp((a+5),(b+5)))>0){
    fseek(f,-102,SEEK_CUR);
    fwrite(b,51,1,f);
    fwrite(a,51,1,f);
    n=1;
   }
   fseek(f,-51,SEEK_CUR);


  }
 }
 fclose(f);
 return;
}

Add a code snippet to your website: www.paste.org