Funkcija udalenija tekushhej zapisi void del int Tbase clear fopen FIL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
/*Funkcija udalenija tekushhej zapisi*/
void del(int i)
{ Tbase b;
clear();
f=fopen(FILENAME,"r+b");
if (i+def!=n2-1)
{
fseek(f,(n2-1)*sizeof(Tbase),0);
fread(&b,sizeof(Tbase),1,f);
fseek(f,(base[i].offs),0);
b.offs=ftell(f);
fwrite(&b,sizeof(b),1,f);
}
fflush(f);
chsize(fileno(f),sizeof(Tbase)*(n2-1));
fclose(f);
clean();
load_cars();
view_cars();
n2--;