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 590207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:30:15+00:00 2026-05-13T15:30:15+00:00

void printLine(const wchar_t* str, …) { // have to do something to make it

  • 0
void printLine(const wchar_t* str, ...) 
{
  // have to do something to make it work
  wchar_t buffer[2048];        
  _snwprintf(buffer, 2047, ????);
  // work with buffer
}

printLine(L"%d", 123);

I tried

  va_list vl;
  va_start(vl,str);

and things like this but I didn’t find a solution.

  • 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-05-13T15:30:16+00:00Added an answer on May 13, 2026 at 3:30 pm

    Here’s a simple C code that does this, you will have to include stdarg.h for this to work.

    void panic(const char *fmt, ...){
       char buf[50];
    
       va_list argptr; /* Set up the variable argument list here */
    
       va_start(argptr, fmt); /* Start up variable arguments */
    
       vsprintf(buf, fmt, argptr); /* print the variable arguments to buffer */
    
       va_end(argptr);  /* Signify end of processing of variable arguments */
    
       fprintf(stderr, buf); /* print the message to stderr */
    
       exit(-1);
    }
    

    The typical invocation would be

    panic("The file %s was not found\n", file_name); /* assume file_name is "foobar" */
    /* Output would be: 
    
    The file foobar was not found
    
    */
    

    Hope this helps,
    Best regards,
    Tom.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that is interacting with the Keychain. You pass in a
I have made a little program in java that accepts a string as a
I have written a java class for my class project, and all of my
I'm trying to print call stack from within a program. Unfortunately, call to glibc
I am using the built in qsort to sort an array of structs. But
For a c++ arm application I need to trace the memory allocations. To this
I am trying to Create a simple Tcp Server in C++ using Boost ASio
I've passed a 2D array from a C++ class to a CUDA function; however,
The assignment, for my data structures class, is to find the shortest path from
I am trying to connect Java code to mySQL. Here is the error that

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.