C++ invalid operands of types ‘char*’ and ‘const char [2]’ to binary ‘operator+’


the compiler return me the error "invalid operands of types 'char*' and 'const char [2]' to binary 'operator+'" when trying to do this simple code:

BodyText[client] = PS3::ReadString(0x0178646c) + "\n" ;

Here my ReadString() function:

char returnRead[100];
char* ReadString(int address)
    memset(&returnRead[0], 0, sizeof(returnRead));
    int strlength = 100;
    char* StrBytes = ReadBytes(address, strlength);
    for (int i = 0; i < strlength; i++)
        if (StrBytes[i] != 0x00)
            returnRead[i] = StrBytes[i];
return returnRead;

Thanks anyway for reading

Best Solution

This is because there is no operator+ for char* (the return-type of your function) and const char[2] (the type of "\n"), and since you cannot overload operators for built-in types, there cannot be one. Since this question is tagged C++:

Just use std::string instead of char*, all your problems are solved already. std::string will be superior to the hacks you try to do.

Here you can find a overview over strings features and examples how to use them. You then can concatenate strings a,b,c like std::string new_string = a + b + c;