ok, maybe I can point you to this line:

buf = new char(get_length (s)+1);

Here you are calling the constructor of a char and assigning it the value of get_length(s) + 1. To allocate an array, you need to use [ and ].

buf = new char[get_length(s)+1];