当前位置: 首页>>代码示例>>C++>>正文


C++ scan_files函数代码示例

本文整理汇总了C++中scan_files函数的典型用法代码示例。如果您正苦于以下问题:C++ scan_files函数的具体用法?C++ scan_files怎么用?C++ scan_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了scan_files函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: file_scan

/**
  * @brief  file_scan处理非递归过程,
	*					删除旧的playlist(用于存储歌曲路径,用于文件定位)和lcdlist(用于存储歌曲列表,用于显示)
  * @param  path:初始扫描路径
  * @retval none
  */
static void file_scan(char* path)
{ 
	
  fres = f_unlink("0:mp3player/playlist.txt");//删除旧的playlist
	fres = f_unlink("0:mp3player/lcdlist.txt");	//删除旧的playlist
	fres = scan_files(path);				//递归扫描歌曲文件
}
开发者ID:WildfireTeamPRJ,项目名称:wildfire_stm32_iso,代码行数:13,代码来源:mp3.c

示例2: scan_files

FRESULT scan_files (
    char* path        /* Start node to be scanned (***also used as work area***) */
)
{
    FRESULT res;
    DIR dir;
    UINT i;
    static FILINFO fno;


    res = f_opendir(&dir, path);                       /* Open the directory */
    if (res == FR_OK) {
        for (;;) {
            res = f_readdir(&dir, &fno);                   /* Read a directory item */
            if (res != FR_OK || fno.fname[0] == 0) break;  /* Break on error or end of dir */
            if (fno.fattrib & AM_DIR) {                    /* It is a directory */
                sprintf(&path[i = strlen(path)], "/%s", fno.fname);
                res = scan_files(path);                    /* Enter the directory */
                if (res != FR_OK) break;
                path[i] = 0;
            } else {                                       /* It is a file. */
                send_uart(path);
                send_uart("/");
                send_uart(fno.fname);
                send_uart("\n");
                //printf("%s/%s\n", path, fno.fname);
            }
        }
        f_closedir(&dir);
    }

    return res;
}
开发者ID:mathiasee,项目名称:patmos,代码行数:33,代码来源:fs_test.c

示例3: scan_files

static FRESULT scan_files(BaseChannel *chp, char *path) {
  FRESULT res;
  FILINFO fno;
  DIR dir;
  int i;
  char *fn;

  res = f_opendir(&dir, path);
  if (res == FR_OK) {
    i = strlen(path);
    for (;;) {
      res = f_readdir(&dir, &fno);
      if (res != FR_OK || fno.fname[0] == 0)
        break;
      if (fno.fname[0] == '.')
        continue;
      fn = fno.fname;
      if (fno.fattrib & AM_DIR) {
        path[i++] = '/';
        strcpy(&path[i], fn);
        res = scan_files(chp, path);
        if (res != FR_OK)
          break;
        path[i] = 0;
      }
      else {
        chprintf(chp, "%s/%s\r\n", path, fn);
      }
    }
  }
  return res;
}
开发者ID:chcampb,项目名称:J1772AdapterFirmware,代码行数:32,代码来源:main.c

示例4: TimerHandler

/*
 * Executed as event handler at 500mS intervals.
 */
static void TimerHandler(eventid_t id) {

  (void)id;
  if (!palReadPad(IOPORT1, PA_BUTTON1)) {
    if (fs_ready) {
      FRESULT err;
      uint32_t clusters;
      FATFS *fsp;

      err = f_getfree("/", &clusters, &fsp);
      if (err != FR_OK) {
        chprintf((BaseSequentialStream *)&SD1, "FS: f_getfree() failed\r\n");
        return;
      }
      chprintf((BaseSequentialStream *)&SD1,
               "FS: %lu free clusters, %lu sectors per cluster, %lu bytes free\r\n",
               clusters, (uint32_t)MMC_FS.csize,
               clusters * (uint32_t)MMC_FS.csize * (uint32_t)MMCSD_BLOCK_SIZE);
      fbuff[0] = 0;
      scan_files((BaseSequentialStream *)&SD1, (char *)fbuff);
    }
  }
  else if (!palReadPad(IOPORT1, PA_BUTTON2)) {
    static WORKING_AREA(waTestThread, 256);
    Thread *tp = chThdCreateStatic(waTestThread, sizeof(waTestThread),
                                   NORMALPRIO, TestThread, &SD1);
    chThdWait(tp);
    buzzPlay(500, MS2ST(100));
  }
}
开发者ID:0x00f,项目名称:ChibiOS,代码行数:33,代码来源:main.c

示例5: scan_files

static FRESULT scan_files(BaseSequentialStream *chp, char *path) {
  static FILINFO fno;
  FRESULT res;
  DIR dir;
  size_t i;
  char *fn;

  res = f_opendir(&dir, path);
  if (res == FR_OK) {
    i = strlen(path);
    while (((res = f_readdir(&dir, &fno)) == FR_OK) && fno.fname[0]) {
      if (FF_FS_RPATH && fno.fname[0] == '.')
        continue;
      fn = fno.fname;
      if (fno.fattrib & AM_DIR) {
        *(path + i) = '/';
        strcpy(path + i + 1, fn);
        res = scan_files(chp, path);
        *(path + i) = '\0';
        if (res != FR_OK)
          break;
      }
      else {
        chprintf(chp, "%s/%s\r\n", path, fn);
      }
    }
  }
  return res;
}
开发者ID:ChibiOS,项目名称:ChibiOS,代码行数:29,代码来源:main.c

示例6: scan_files

static FRESULT scan_files (
	char* path		/* Pointer to the path name working buffer */
)
{
	DIR 	dirs;
	FRESULT res;
	BYTE 	i;
	char*	fn;


	if ((res = f_opendir(&dirs, path)) == FR_OK) {
		i = strlen(path);
		while (((res = f_readdir(&dirs, &Finfo)) == FR_OK) && Finfo.fname[0]) {
			if (_FS_RPATH && Finfo.fname[0] == '.') continue;
#if _USE_LFN
			fn = *Finfo.lfname ? Finfo.lfname : Finfo.fname;
#else
			fn = Finfo.fname;
#endif
			if (Finfo.fattrib & AM_DIR) {
				AccDirs++;
				*(path+i) = '/'; strcpy(path+i+1, fn);
				res = scan_files(path);
				*(path+i) = '\0';
				if (res != FR_OK) break;
			} else {
				/*xprintf("%s/%s\n", path, fn);*/
				AccFiles++;
				AccSize += Finfo.fsize;
			}
		}
	}

	return res;
}
开发者ID:armsvb,项目名称:cadi-gcl,代码行数:35,代码来源:ff_support.c

示例7: cmd_tree

static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) {
  FRESULT err;
  uint32_t fre_clust;
  FATFS *fsp;

  (void)argv;
  if (argc > 0) {
    chprintf(chp, "Usage: tree\r\n");
    return;
  }
  if (!fs_ready) {
    chprintf(chp, "File System not mounted\r\n");
    return;
  }
  err = f_getfree("/", &fre_clust, &fsp);
  if (err != FR_OK) {
    chprintf(chp, "FS: f_getfree() failed\r\n");
    return;
  }
  chprintf(chp,
           "FS: %lu free clusters with %lu sectors (%lu bytes) per cluster\r\n",
           fre_clust, (uint32_t)fsp->csize, (uint32_t)fsp->csize * 512);
  fbuff[0] = 0;
  scan_files(chp, (char *)fbuff);
}
开发者ID:ChibiOS,项目名称:ChibiOS,代码行数:25,代码来源:main.c

示例8: scan_files

static FRESULT scan_files(char* path)
{
	FRESULT res;
	FILINFO fno;
	DIR dir;
	int i;
	char *fn;

	res = f_opendir(&dir, path);
	if (res == FR_OK)
	{
		i = strlen(path);
		for (;;)
		{
			res = f_readdir(&dir, &fno);
			if (res != FR_OK || fno.fname[0] == 0) break;
			fn = fno.fname;
			if (*fn == '.') continue;
			if (fno.fattrib & AM_DIR)
			{
				TRACE_MSG(&path[i], "/%s", fn);
				res = scan_files(path);
				if (res != FR_OK) break;
				path[i] = 0;
			}
			else
			{
				DEBUG_MSG("%s/%s", path, fn);
			}
		}
	}

	return res;
}
开发者ID:Meteroi,项目名称:mboot,代码行数:34,代码来源:mboot.c

示例9: scan_files

void
scan_files(char* path)
{
	FRESULT res;
	FILINFO fno;
	DIR dir;
	int i;

	/* Open the directory */
	res = f_opendir(&dir, path);
	if (res != FR_OK)
		return;

	i = strlen(path);
	do {
		/* Read a directory item */
		res = f_readdir(&dir, &fno);
		if (res != FR_OK || fno.fname[0] == 0)
			break;

		/* Ignore dot entry */
		if (fno.fname[0] == '.')
			continue;

		/* Recursively scan subdirectories */
		path[i] = '/';
		strcpy(&path[i+1], fno.fname);
		if (fno.fattrib & AM_DIR)
			scan_files(path);
		else
			printf("%s\n", path);
		path[i] = 0;
	} while (1);
}
开发者ID:LGTMCU,项目名称:f32c,代码行数:34,代码来源:sdcard_test.c

示例10: scan_root

void scan_root(void){
	if (artist_list != NULL) {rprintf("already scanned.\n");return;}
	char long_pathname[40] = "0:/MUSIC";
	rprintf("scanning 0:/MUSIC\n");
	scan_files(long_pathname);

	rprintf("found artists: ");

	num_of_artists = 0;
	unsigned int num_of_tracks = 0;
	Artist * list_cpy = artist_list;
	while(list_cpy != NULL) {
		num_of_artists++;

		list_cpy->tracks = bubblesort(list_cpy->tracks);
		unsigned int arts_trks = 0;
		for (Track *tmp=list_cpy->tracks; tmp->next != NULL; tmp=tmp->next) { arts_trks++; } //counts how many tracks this artist has
		rprintf("%s [%i], ",list_cpy->name, arts_trks );
		num_of_tracks += arts_trks; //add artist total to the overall total.

		list_cpy = list_cpy->next;
	}

	rprintf("\nnumber of: artists=%i, tracks=%i \n",num_of_artists,num_of_tracks);
}	
开发者ID:t413,项目名称:mp3_player_v2,代码行数:25,代码来源:mp3.c

示例11: cmd_tree

static void cmd_tree(BaseChannel *chp, int argc, char *argv[]) {
  FRESULT err;
  uint32_t clusters;
  FATFS *fsp;

  (void)argv;
  if (argc > 0) {
    chprintf(chp, "Usage: tree\r\n");
    return;
  }
  if (!fs_ready) {
    chprintf(chp, "File System not mounted\r\n");
    return;
  }
  err = f_getfree("/", &clusters, &fsp);
  if (err != FR_OK) {
    chprintf(chp, "FS: f_getfree() failed\r\n");
    return;
  }
  chprintf(chp,
           "FS: %lu free clusters, %lu sectors per cluster, %lu bytes free\r\n",
           clusters, (uint32_t)MMC_FS.csize,
           clusters * (uint32_t)MMC_FS.csize * (uint32_t)MMC_SECTOR_SIZE);
  fbuff[0] = 0;
  scan_files(chp, (char *)fbuff);
}
开发者ID:chcampb,项目名称:J1772AdapterFirmware,代码行数:26,代码来源:main.c

示例12: scan_files

FRESULT scan_files (char* path)
{
    FRESULT res;
    FILINFO fno;
    DIR dir;
    char bufpath[12];
    res = pf_opendir(&dir, path);
    if (res == FR_OK) {
        for (;;) {
            res = pf_readdir(&dir, &fno);
           if (res != FR_OK || fno.fname[0] == 0) break;
            if (fno.fattrib & AM_DIR) {
                psprintf(bufpath, "/%s", fno.fname);
                res = scan_files(bufpath);
                if (res != FR_OK) break;
            } else {
                #ifdef SERIAL_PRINT
				serial_printf("%s/", path);
                serial_printf("%s\r\n", fno.fname);
				#endif
                #ifdef CDC_PRINT
                CDCprintf("%s/", path);
                CDCprintf("%s\r\n", fno.fname);
				#endif
            }
        }
    }

    return res;
}
开发者ID:AgustinParmisano,项目名称:pinguino32,代码行数:30,代码来源:pff.c

示例13: scan_files

static
FRESULT scan_files (char* path)
{
  DWORD acc_size;				/* Work register for fs command */
WORD acc_files, acc_dirs;
FILINFO finfo;
	DIR dirs;
	FRESULT res;
	BYTE i;


	if ((res = f_opendir(&dirs, path)) == FR_OK) {
		i = strlen(path);
		while (((res = f_readdir(&dirs, &finfo)) == FR_OK) && finfo.fname[0]) {
			if (finfo.fattrib & AM_DIR) {
				acc_dirs++;
				*(path+i) = '/'; strcpy(path+i+1, &finfo.fname[0]);
				res = scan_files(path);
				*(path+i) = '\0';
				if (res != FR_OK) break;
			} else {
				acc_files++;
				acc_size += finfo.fsize;
			}
		}
	}

	return res;
}
开发者ID:a-c-t-i-n-i-u-m,项目名称:HY-STM32F103,代码行数:29,代码来源:main1.c

示例14: scan_files

FRESULT scan_files(char* path)
{
	DIR dirs;
	FRESULT res;
	int i;
	char *fn;

	if ((res = f_opendir(&dirs, path)) == FR_OK) {
		i = strlen(path);
        //CDCprintln("scan path: %s", path);
		while (((res = f_readdir(&dirs, &Finfo)) == FR_OK) && Finfo.fname[0])
        {
			if (_FS_RPATH && Finfo.fname[0] == '.')
				continue;

            #if _USE_LFN
			fn = *Finfo.lfname ? Finfo.lfname : Finfo.fname;
            #else
			fn = Finfo.fname;
            #endif

			if (Finfo.fattrib & AM_DIR)
            {
				AccDirs++;
                //CDCprintln("next path: %s", fn);

				/* FIXME: doubles code size!
				char * s = malloc(snprintf(NULL, 0, "%s/%s", path, fn) + 1);
				sprintf(s, "%s/%s", path, fn); */
				res = scan_files(s);

				/* FIXME: seg fault
				path[i] = '/';
				CDCprintln("#1: %s", path);
				mem_cpy(&path[i + 1], fn);
				CDCprintln("#2: %s", path);
				res = scan_files(path);
				path[i] = 0;
				CDCprintln("#3: %s", path);  */

				if (res != FR_OK)
					break;
			}
            
            else
            {
                #if 0
				CDCprintln("%s/%s\n", path, fn);
                #endif
				AccFiles++;
				AccSize += Finfo.fsize;
			}
		}
	}

	return res;
}
开发者ID:jimgregory,项目名称:pinguino-libraries,代码行数:57,代码来源:extra.c

示例15: play_wav

FRESULT play_wav(void)
{
	FATFS fs;
	FRESULT rslt;
	volatile uint8_t dmy = 0xff;

	/* SS   = PC0 = Out,hi   */
	/* SCK  = PC1 = Out,lo   */
	/* MISO = PC2 = In, hi-z */
	/* MOSI = PC3 = Out,hi   */

	PORTC.DIRSET   = PIN0_bm;
	PORTC.OUTSET   = PIN0_bm;

	PORTC.DIRSET = PIN1_bm | PIN3_bm;
	PORTC.OUTCLR = PIN1_bm;
	PORTC.OUTSET = PIN3_bm;

	PORTC.DIRCLR = PIN2_bm;

	/* Setup USART C0 as MSPI mode */
	USARTC0.CTRLC = USART_CMODE_MSPI_gc;	/* SPI Mode 0, MSB first */
	USARTC0.CTRLB = USART_TXEN_bm | USART_RXEN_bm;
	USARTC0.BAUDCTRLA = 63;

	/* Setup DMA for USART SPI */
	EDMA.CTRL = EDMA_ENABLE_bm | EDMA_CHMODE_STD02_gc
			   | EDMA_DBUFMODE_DISABLE_gc | EDMA_PRIMODE_CH0123_gc;

	/* DMA Chennel0 -> Transfer from USARTC0.Data to buffer */
	EDMA.CH0.ADDRCTRL     = EDMA_CH_RELOAD_NONE_gc | EDMA_CH_DIR_FIXED_gc;
	EDMA.CH0.ADDR         = (uint16_t)(&USARTC0.DATA);
	EDMA.CH0.DESTADDRCTRL = EDMA_CH_RELOAD_NONE_gc | EDMA_CH_DIR_INC_gc;
	EDMA.CH0.TRIGSRC      = EDMA_CH_TRIGSRC_USARTC0_RXC_gc;

	/* DMA Chennel2 -> Transfer dummy 0xff to USARTC0.Data */
	EDMA.CH2.ADDRCTRL     = EDMA_CH_RELOAD_NONE_gc | EDMA_CH_DIR_FIXED_gc;
	EDMA.CH2.ADDR         = (uint16_t)(&dmy);
	EDMA.CH2.DESTADDRCTRL = EDMA_CH_RELOAD_NONE_gc | EDMA_CH_DIR_FIXED_gc;
	EDMA.CH2.DESTADDR     = (uint16_t)(&USARTC0.DATA);
	EDMA.CH2.TRIGSRC      = EDMA_CH_TRIGSRC_USARTC0_DRE_gc;

	f_mount(&fs, "", 0);
	rslt = scan_files();

	EDMA.CH0.CTRLA = 0;
	EDMA.CH2.CTRLA = 0;
	EDMA.CTRL = 0;

	USARTC0.CTRLB     = 0;

	PORTC.OUTSET = PIN0_bm;

	return rslt;
}
开发者ID:mick909,项目名称:ncnl,代码行数:55,代码来源:playwav.c


注:本文中的scan_files函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。