First buffer doesn't point to allocated memory. It points 'somewhere'. You must allocate space first, memcpy doesn't do that.
buffer = new char(100); // c++ style
buffer = (char*)malloc(100*sizeof(char)); // c style
(edited this, I don't know why i was under impression it used printf
Secondly, . By copying only the 5 charachters, you don't know what the 6th will be.
So you should print only what you copy.
Thrid: memcpy needs pointers to memory locations. Not pointers to pointers to memory locations. So you should do:
You should take it a little easier if you are new to c++. Maybe it would be a good idea to read one or two more tutorials.