AnsweredAssumed Answered

How to use IO_IOCTL_FIND_FIRST_FILE   AND  IO_IOCTL_FIND_NEXT_FILE to find files in a USB STICK

Question asked by OLIVIA CHRISTY VARGHESE on Sep 8, 2016
Latest reply on Sep 12, 2016 by OLIVIA CHRISTY VARGHESE

Hi guys,

 

Can anyone explain me how to use this IO_IOCTL_FIND_FIRST_FILE and IO_IOCTL_FIND_NEXT_FILE effectively to find files in a USB stick . The code I wrote with this is not working. This is the first time I am using this so I dont know how it works.

 

while ((len = _io_mfs_dir_read(dir_ptr, buffer, 100))>0){
strcpy(USB_Files,buffer);
//printf(USB_Files);

//List all files and subdirectories in a directory.


error_code = _io_ioctl(mfs_fd_ptr, IO_IOCTL_FIND_FIRST_FILE,
&search);
if (error_code != MQX_OK) {
return error_code;
printf("\n\rFile read unsuccessful");
}
else
printf("\r\nReading Files Successful");
error_code = _io_ioctl(mfs_fd_ptr, IO_IOCTL_FIND_NEXT_FILE,
&search_data);

}
}
_io_mfs_dir_close(dir_ptr);

 

Please help

 

Regards,

Olivia

Outcomes