char * str = new char[foo.GetLength()+1];
じゃだめなの?