It works fine with Null terminated C strings.
This from example: ...\hardware\teensy\avr\libraries\LittleFS\example s\Test_Integrity\PROG\functions.ino
"char szPath[150];" is built with sprintf() - other logic removed - but this shows working steps in some fashion:
Code:
...
uint32_t fileCycle(const char *dir) {
static char szFile[] = "_file.txt";
char szPath[150];
int ii;
lCnt++;
byte nNum = lCnt % MAXNUM;
char chNow = 'A' + lCnt % MAXNUM;
lfs_ssize_t resW = 1;
uint32_t timeMeAll = micros();
if ( dir[1] == 0 ) // catch root
sprintf( szPath, "/%c%s", chNow, szFile );
else
sprintf( szPath, "%s/%c%s", dir, chNow, szFile );
...
Serial.printf( ":: %s ", szPath );
...
file3 = myfs.open(szPath, FILE_WRITE);
...