Replace c string code with c++ versions