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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:09:47+00:00 2026-05-16T00:09:47+00:00

I have the following statement: vsnprintf(target, size – 1, %ls_%ls, str16_1, str16_2); Why does

  • 0

I have the following statement:

vsnprintf(target, size - 1, "%ls_%ls", str16_1, str16_2);

Why does this fail on gcc?

I used this on Windows like this:

vsnprintf(target, size - 1, "%S_%S", str16_1, str16_2);

and it’s working as expected. On gcc documentation I found that %S is synonym with %ls, but I must not use it. I tried also with %S, but is not working. I use this in a function with variable argument list. Is it possible to not work because I change the format variable that I pass to va_start? I must search %S and replace it with %ls in format variable.

The function is something like:

void f(const char* format, ...){
  char* new_format = format with %S replaced with %ls;
  va_list argptr;
  va_start(args, format);
  vsnprintf(str, size-1, new_format, argptr);
}

I checked and new_format is correct.

Thank you!

  • 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-16T00:09:48+00:00Added an answer on May 16, 2026 at 12:09 am

    Because I use this on Mac I found a work-around:

    How to "pass on" a variable number of arguments to NSString's +stringWithFormat:

    It seems that vsnprintf can’t handle 16 bits string. Maybe because wchar_t isn’t 16 bits.

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

Sidebar

Related Questions

I have the following statement: btnApply.Attributes.Add(onclick, alert('Must be a member to Use this Tool'));
I have the following statement SELECT id, descr from mytable which returns 1, 'Test1'
I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name =
I have the following SQL Statement. I need to select the latest record for
Given the following example, why do I have to explicitly use the statement b->A::DoSomething()
I have following statement for query articles from some sections Article.all(:joins => :sections, :conditions
I have following statement in one of the oracle SP: OPEN CUR_NUM FOR SELECT
I have following LINQ statement and I want to rewrite it using extension methods.
I have the following statement DateTime now = DateTime.Now; string test = string.Format({0}{1}{2}{3}, now.Day,
I have the following statement, and it works fine, except for the fact 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.