本文整理汇总了C++中scan_files函数的典型用法代码示例。如果您正苦于以下问题:C++ scan_files函数的具体用法?C++ scan_files怎么用?C++ scan_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scan_files函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: cmd_listfiles
static void cmd_listfiles(BaseSequentialStream *chp, int argc, char *argv[])
{
(void)argv;
if (argc > 0) return;
if(fs_ready)
{
chprintf(chp, "Listing files on the SD card ...\r\n");
scan_files(chp, rootpath);
}
}
开发者ID:vpcola,项目名称:NucleoCC3K,代码行数:11,代码来源:main.cpp
示例17: main
void main()
{
FATFS fs;
FIL file;
InitMCU();
//VS_SinTest(0x74);
VS_Init();
if(disk_initialize(0))
ConsoleWrite("Disk Initialization FAILED. :(\n");
else
ConsoleWrite("Disk Initialization Complete.\n");
if(f_mount(0,&fs))
ConsoleWrite("Mount FieSystem Failed\n");
else
ConsoleWrite("Mount FileSystem Success!\n");
ConsoleWrite("Scaning Music Files...\n\n");
if(scan_files("/",&(Player.TotalSongNum)))
ConsoleWrite("Scan Files Failed\n");
else{
ConsoleWrite("\nScan Files Accomplished.\ntotal files: ");
ConsolePutUInt (Player.TotalSongNum);
ConsoleWrite ("\n\n");}
if(scan_files_open (&file,"/",1)) // Start node to be scanned and opened
ConsoleWrite("Open File Error\n"); //Playing mp3/track001.mp3 ... will apear in function
Player.currFile = &file;
Player.SongNum = 1;
Player.Status = PS_PLAYING;
Player.Mode = SM_SONG;
Player.Volume = 170;
Player.Bass = 7;
Player.Treble = 0;
VS_SetBassTreble(Player.Bass,Player.Treble);
BufCnt = 0;
// GenerateEvent(EV_BUFEMPTY);
//Main loop
while(1)
{
//Get system event
Player.Event = GetEvent();
//Handle Events
HandleEvent();
}
}
开发者ID:solokacher,项目名称:iCandle,代码行数:53,代码来源:player.c
示例18: main
int main(int argc, char **argv) {
progname = argv[0];
buf_init(module, INIT_MODS, 1, struct _module, "modules");
buf_init(dep, INIT_MODS, 1, int, "dependencies");
stack_size = STACK_SIZE;
get_options(argc, argv);
if (nfiles == 0 && !dump) panic("no input files");
if (stdlib && libdir == NULL) panic("no libdir specified");
if (rtlibdir == NULL) rtlibdir = libdir;
make_prim("INTERP");
make_prim("DLTRAP");
#define bind(x) def_global(find_symbol(#x), ABS, x, X_SYM)
bind(GC_BASE); bind(GC_REPEAT); bind(GC_BLOCK);
bind(GC_MAP); bind(GC_FLEX); bind(GC_END);
bind(E_CAST); bind(E_ASSIGN); bind(E_CASE);
bind(E_WITH); bind(E_ASSERT); bind(E_RETURN);
bind(E_BOUND); bind(E_NULL); bind(E_DIV);
bind(E_FDIV); bind(E_STACK); bind(E_GLOB);
/* First pass -- check for dependencies */
scan_files();
/* Compute needed modules */
buf_grow(module);
module[nmodules].m_dep = ndeps;
trace_imports();
if (status != 0) return status;
/* Second pass -- link the modules that are needed */
if (!dump) {
init_linker(outname, interp);
load_needed();
gen_main();
if (rtlibdir != NULL)
save_string("LIBDIR", rtlibdir);
end_linking();
}
if (dump || custom) {
printf("/* Primitive table -- generated by oblink */\n\n");
printf("#include \"obx.h\"\n\n");
dump_prims(stdout);
}
return status;
}
开发者ID:epithatree,项目名称:Compilers,代码行数:53,代码来源:oblink.c
示例19: main
void
main(void)
{
char tmpbuf[128];
int f;
tmpbuf[0] = '1';
tmpbuf[1] = ':';
tmpbuf[2] = 0;
f = open(tmpbuf, O_RDONLY);
if (f > 0)
close(f);
scan_files(tmpbuf);
}
开发者ID:LGTMCU,项目名称:f32c,代码行数:14,代码来源:sdcard_test.c
示例20: scan_files
static FRESULT scan_files(char *path)
{
FRESULT res;
FILINFO fno;
DIR dir;
int32_t i;
char *pc_fn;
#if _USE_LFN
char c_lfn[_MAX_LFN + 1];
fno.lfname = c_lfn;
fno.lfsize = sizeof(c_lfn);
#endif
/* Open the directory */
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 _USE_LFN
pc_fn = *fno.lfname ? fno.lfname : fno.fname;
#else
pc_fn = fno.fname;
#endif
if (*pc_fn == '.') {
continue;
}
/* Check if it is a directory type */
if (fno.fattrib & AM_DIR) {
sprintf(&path[i], "/%s", pc_fn);
res = scan_files(path);
if (res != FR_OK) {
break;
}
path[i] = 0;
} else {
printf("%s/%s\n\r", path, pc_fn);
}
}
}
return res;
}
开发者ID:Goblin-Tech,项目名称:Zeppelin-FC,代码行数:49,代码来源:zeppelin_fc.c
注:本文中的scan_files函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论