Hopefully someone can show me a 'best way' to do substrings.... my plans are to simply return a pointer to a new string that I will assign CurrentText to....
But my real problem is that I am getting this pesky "error: expected primary-expression before 'char'" and it is pointing at the 'char substr(' on the bottom.....
here's the code....
#include <Mlcd.h>
char ScrollText[255] = "\0";
char CurrentText[255] = "\0";
char tmpStr[255] = "\0";
int CurPos = 0;
int CurDir = 1;
Mlcd mLCD(19200);
char substr(*char, int, int);
void setup()
{
mLCD.start();
mLCD.clrScrn();
strcat(ScrollText, "Bluegrass Digital Inc.");
}
void loop()
{
while (1)
{
if (CurDir == 1)
{
strncat(CurrentText, &ScrollText[CurPos], 1);
}
if (strlen(CurrentText) > 16)
{
//strncpy(CurrentText, *(&CurrentText+1), 16);
}
if (CurPos < strlen(ScrollText)) {CurPos += CurDir;} else {CurDir = -1;}
mLCD.setCursor(16 - strlen(CurrentText), 1);
mLCD.sendText(CurrentText);
delay(200);
}
}
char substr(*char srcStr, int start, int length)
{
}