String manipulation is unnecessarily complex in C as far as I can tell. Every time I have to do even the simplest thing, it just becomes quickly impossible. I am trying to do a simple concatenation and it has proven impossible after many hours of reading and trying stuff. Help, please. I cannot get by the compiler.
myFiles.loadBitmap(0, 0, picsize_x, picsize_y, AdvPix[curAdvPic]); requires the filename to be in a char* array. It won't function with a String array. I can't find any combination of stuff to load the filenames I find with findFirstFile into the char* array so loadBitmap can load the file onto the TFT display.
When I load the array with constants, all is well:
char* AdvPix[MaxPix]={"PIC801.ADV", "PIC802.RAW", "PIC803.RAW", "PIC804.RAW", "PIC805.RAW", "", "", "", "", ""};
It finds the files and load them into the display. They display properly. But trying to programmatically find what is on the SD card and storing it the array for later retrieval and display of the files has me totally stopped. This is not a real, working program, just a demo to try to make the compiler happy. If this can be made correct, then I can make the real program work.
How can this be made to work? My brain now hurts. Any help graciously appreciated and applauded!
#include <tinyFAT.h>
#include <UTFT.h>
#include <UTFT_tinyFAT.h>
#define MaxPix 100
char* AdvPix[MaxPix]={"PIC801.RAW", ""};
String FN, FT;
word res;
void setup() {
res = file.findFirstFile(&file.DE); // get first file
//Here's the compiler failure. Should be so simple!
AdvPix[1] = file.DE.filename; + "." + file.DE.fileext;
res = myFiles.loadBitmap(0, 0, picsize_x, picsize_y, AdvPix[1]);
}
void loop() {
// put your main code here, to run repeatedly:
}