Skip to content

CBString::format causes access violation issues #21

@bajoraitisd

Description

@bajoraitisd

I wanted to use CBString::format() function in my logger implementation, but it causes access violation errors in my application (it's always in the same place, if I replace code with char[] everything works just fine).

Similar code using c-strings works just fine:

void log(const char* format, const char* arg1, const char* arg2)
{
    char buffer[2048];
    sprintf_s((char*)&buffer, sizeof(buffer), format, arg1, arg2);
    logtofile(buffer);
}

Example with CBString::format:

// this causes AV errors sometimes, don't know exactly why
void logBStrLib(const char* format, const char* arg1, const char* arg2)
{
    Bstrlib::CBString buffer;
    buffer.format(format, arg1, arg2);
    logtofile((const char*)buffer);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions