shifting chard in an array

Evening All
Would some kindly sole please tell me how to remove x number of chars from the front of a char array of length MAX_CHARS and shift all the remaining chars down ?
My array is a fixed length, but the chars are terminated by a # character.
Oh I do love CString !!!

Many thanks
Phil

You could use memmove:

http://www.cplusplus.com/reference/clibrary/cstring/memmove/

Example:

const int MAX_CHARS = 100;

void setup ()
{
  char buf [MAX_CHARS] = "But does it get goat's blood out?";
  
  int amount = 4;
  
  memmove (buf, &buf [amount], MAX_CHARS - amount);
  
  Serial.begin (115200);
  Serial.println (buf);
}
void loop () {}

Output:

does it get goat's blood out?

Thanks Nick
Id forgotten what little support C has for strings !!

Phil

C has reasonable support for strings. The Arduino comes with a String class, and you can use the STL std::string class if you install STL. Plus all the usual C string manipulation. Plus streams.

However remember memory is tight. It might be better to advance your pointer to point 4 bytes in (effectively removing the head of the string) rather than copying bytes here and there.

Yes, Memory is the problem.

I implemented my solution using the String class and by the time I had finished reading the serial port, and done a bit of searching, I ran right out of memory!
Thus my delve back into the dark times before VC++'s CString class !!!! (and more memory than you can shake a stick at lol)

Thanks again for your help

Phil

Thus my delve back into the dark times before VC++'s CString class !

It was only dark then if you didn't understand arrays and pointer manipulation. Plenty light if you did.