Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBString::format causes access violation issues #21

Open
bajoraitisd opened this issue Feb 16, 2020 · 0 comments
Open

CBString::format causes access violation issues #21

bajoraitisd opened this issue Feb 16, 2020 · 0 comments

Comments

@bajoraitisd
Copy link

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant