Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8201447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:49:05+00:00 2026-06-07T06:49:05+00:00

I am getting an exception of a bad pointer (0xcccccccc ) for temp below

  • 0

I am getting an exception of a bad pointer (0xcccccccc ) for temp below under case ‘s’:

string Logger::format(const char *str, va_list args)
{
    ostringstream output;

    for(int i = 0; i < strlen(str); ++i)
    {
        if(str[i] == '%' && str[i+1] != '%' && i+1 < strlen(str))
        {
            switch(str[i+1])
            {
            case 's':
            {
                char *temp = va_arg(args, char*);
                output << temp;
                break;
            }
            case 'i':
            {
                int temp = va_arg(args, int);
                output << temp;
                break;
            }
            case 'd':
            {
                double temp = va_arg(args, double);
                output << temp;
                break;
            }
            case 'f':
            {
                float temp = va_arg(args, float);
                output << temp;
                break;
            }
            default:
                output << str[i];
            }

            i++;
        }
        else
        {
            output << str[i];
        }
    }

    return output.str();
}

The above function is called by this:

void Logger::debugFormat(string message, ...)
{
    const char* cstr = message.c_str();

    va_list args;
    va_start(args, cstr);

    record(DEBUGGING, format(cstr, args));

    va_end(args);
}

I am calling the above this way in all my code

Logger::debugFormat("Loading Image %s", path.c_str());

Any other type (int, double, float) work all fine. Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:49:08+00:00Added an answer on June 7, 2026 at 6:49 am

    You aren’t using va_start properly. The second argument is supposed to be the function parameter after which the variable list of arguments (represented by ...) starts. That is, it should be:

    va_start(args, message);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting an exception error, Input string was not in a correct format.
i'm getting exception on Transformer transformer = tFactory.newTransformer(StreamXSL); but the error below is not
Iam trying to authenticate to https url , but iam getting exception . Below
I am getting below exception in runtime, could anybody suggest what is wrong? Microsoft
I keep getting bad instruction or bad exception so I enabled NSZombieEnabled and the
im getting sometimes null pointer exception while accessing handler created in thread. I`m using
m getting exception while taping on listView item.. @Override protected void onCreate(Bundle savedInstanceState) {
On my Arch Linux, Eclipse with Google Window Builder/SWT application, I am getting Exception
I am getting this exception when trying to run my PHP unit tests: Fatal
I am getting this exception: Collection was modified; enumeration operation may not execute. Directly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.