Replace the string type with char* in your second code example.