Hi guys,
I was able to read the directory from the usb stick and list it with the help of MQX user guides. Now I need to read a particular wave file from the directory and pass it to the DMA buffer for the DAC output. Please share the fucntion to read a file from this directory using MQX and to save the contents of that file to a buffer so that I can copy it to the DMA buffer.
memset(buffer,0,100);
path_ptr = "*.*";
mode_ptr = "m";
fs_ptr = _io_get_first_valid_fs();
dir_ptr = _io_mfs_dir_open(fs_ptr, path_ptr, mode_ptr );
if (dir_ptr == NULL)
{
printf("File not found.\n");
}
else
{
while ((len = _io_mfs_dir_read(dir_ptr, buffer, 100))>0){
strcpy(USB_Files,buffer);
printf(USB_Files);
}
_io_mfs_dir_close(dir_ptr);
Regards,
Olivia