Dynamic filename path
#define USB_DRIVE_MOUNT_POINT "/usb"
#define USB_MAX_FILEPATH_LENGTH 30
static char FilePathBuffer[USB_MAX_FILEPATH_LENGTH];
//*******************************************
//*******************************************
//********** CREATE FULL FILE PATH **********
//*******************************************
//*******************************************
//Accessing the USB drive needs "/usb" adding in front of the filename
//This function does that and stores it in FilePathBuffer[], returning a pointer to the start of it.
char *UsbDriveFullFilePath(char *pFilename)
{
char *pFullFilePath;
//COMBINE USERS FILENAME WITH OUR USB_DRIVE_MOUNT_POINT
pFullFilePath = (char*)&FilePathBuffer[0];
pFullFilePath = CopyRamCharStringToRam((const char*)USB_DRIVE_MOUNT_POINT, pFullFilePath, &FilePathBuffer[(USB_MAX_FILEPATH_LENGTH-1)]);
*pFullFilePath++ = '/';
pFullFilePath = CopyRamCharStringToRam((const char*)pFilename, pFullFilePath, &FilePathBuffer[(USB_MAX_FILEPATH_LENGTH - 1)]);
return((char*)&FilePathBuffer[0]);
}
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through resources like this. We hope you find it helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support here. If you need help with a problem please use one of the many online forums.