⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs_fdelete.c

📁 keil arm flash fs 最新版 在Keil arm下使用
💻 C
字号:
/*----------------------------------------------------------------------------
 *      R T L  -  F l a s h   F i l e   S y s t e m
 *----------------------------------------------------------------------------
 *      Name:    FS_FDELETE.C 
 *      Purpose: File Delete Function
 *      Rev.:    V3.22
 *----------------------------------------------------------------------------
 *      This code is part of the RealView Run-Time Library.
 *      Copyright (c) 2004-2008 KEIL - An ARM Company. All rights reserved.
 *---------------------------------------------------------------------------*/

#include "File_Config.h"

/*--------------------------- fdelete ---------------------------------------*/

int fdelete (const char *filename) {
   /* Delete a file with name 'filename'. */
   IOB *fcb;
   int handle;

   /* Find an unused _iob structure. */
   if ((handle = fs_find_iob ()) == EOF) {
      return (1);
   }
   fcb = &_iob[handle];
   /* Get the drive index. */
   fcb->drive = fs_get_drive (filename);
   if (fcb->drive != DRV_NONE) {
      /* Skip drive letter 'X:' */
      filename += 2;
   }
   else {
      fcb->drive = _DEF_DRIVE;
   }
   if (fcb->drive == DRV_MCARD) {
      /* Delete a file on Flash Memory Card. */
      if (fat_delete (filename, fcb) == __TRUE) {
         return (0);
      }
      /* File not found error */
      return (1);
   }
   /* Set drive parameters. */
   if (fs_set_params (fcb) == __FALSE) {
      return (1);
   }

   if (fs_Find_File (filename, fcb) == 0) {
      /* File with 'filename' found, delete it. */
      return (_fdelete (fcb));
   }
   /* File not found error */
   return (1);
}

/*----------------------------------------------------------------------------
 * end of file
 *---------------------------------------------------------------------------*/

⌨️ 快捷键说明

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