fat_free.c

来自「MTOOLS version 2.0 Mtools is a p」· C语言 代码 · 共 38 行

C
38
字号
#include <stdio.h>#include "msdos.h"extern int fat_error;extern unsigned int last_fat;/* * Remove a string of FAT entries (delete the file).  The argument is * the beginning of the string.  Does not consider the file length, so * if FAT is corrupted, watch out! */intfat_free(fat)unsigned int fat;{	unsigned int next, fat_decode();					/* a zero length file? */	if (fat == 0)		return(0);	/* CONSTCOND */	while (1) {					/* get next cluster number */		next = fat_decode(fat);					/* mark current cluster as empty */		if (fat_encode(fat, 0) || next == 1) {			fprintf(stderr, "fat_free: FAT problem\n");			fat_error++;			return(-1);		}		if (next >= last_fat)			break;		fat = next;	}	return(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?