I have a function ls() which parses a vector of string and puts it into a comma-separated list, wrapped within parentheses ():
std::string ls(std::vector<std::string> vec, std::string wrap="()", std::string sep=", ") {
    std::string wrap_open, wrap_close;
    wrap_open = std::to_string(wrap[0]);
    wrap_close = std::to_string(wrap[1]);
    std::string result = wrap_open;
    size_t length = vec.size();
    if (length > 0) {
        if (length == 1) {
            result += vec[0];
            result += wrap_close;
        }
        else {
            for (int i = 0; i < vec.size(); i++) {
                if (i == vec.size() - 1) {
                    result += sep;
                    result += vec[i];
                    result += wrap_close;
                }
                else if (i == 0) {
                    result += vec[i];
                }
                else {
                    result += sep;
                    result += vec[i];
                }
            }
        }
    }
    else {
        result += wrap_close;
    }
    return result;
}
If I pass this vector
std::vector<std::string> vec = {"hello", "world", "three"};
to the ls() function, I should get this string:
std::string parsed_vector = ls(vec);
// AKA
std::string result = "(hello, world, three)"
The parsing works fine, however the characters in the wrap string turn into numbers when printed.
std::cout << result << std::endl;
Will result in the following:
40hello, world, three41
When it should instead result in this:
(hello, world, three)
The ( is turned into 40, and the ) is turned into 41.
My guess is that the characters are being turned into the Unicode/ASCII number values or something like that, I do not know how this happened or what to do.
 
     
     
    