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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:30:39+00:00 2026-05-30T06:30:39+00:00

I have started going through the samples of the cURL, in C. While compiling

  • 0

I have started going through the samples of the cURL, in C. While compiling ftpuploadresume.c I am getting undefined reference error at:

/* _snscanf() is Win32 specific */
r = _snscanf(ptr, size * nmemb, "Content-Length: %ld\n", &len);

I just want to know what is the alternative to _snscanf for glibc.

  • 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-30T06:30:40+00:00Added an answer on May 30, 2026 at 6:30 am

    Assuming you use null terminated strings, you can perfectly safely use sscanf() without the second (length) argument. You could on Windows, too. If you don’t know that the string is null terminated but you do know how long it is, add the null terminator. (If you don’t know how long the string is and don’t know whether it is null terminated, nothing is safe!)

    Assuming you have a C99 compiler, you can work the necessary change automatically:

    #define _snscanf(data, length, format, ...) scanf(data, format, __VA_ARGS__)
    

    Beware!

    Note the comment by namey — for which, thanks.

    Look at the Microsoft man pages on _snscanf(). The examples are not compelling; you’d get the same results even without the length being specified. However, it does look as though @namey is correct in general. A lot is going to depend on the context in which it is used. If the length specified is actually strlen(data), then the difference isn’t going to matter. If the length specified is longer than that, the difference probably isn’t going to matter. If the length is smaller than the length of the data, the difference might matter quite a lot.

    A better cover function might be:

    int _snscanf(const char *input, size_t length, const char *format, ...)
    {
        char *copy = malloc(length + 1);
        if (copy == 0)
            return 0;
        memmove(copy, input, length);
        copy[length] = '\0';
        va_list args;
        va_start(args, format);
        int rc = vsscanf(copy, format, args);
        va_end(args);
        free(copy);
        return rc;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Going through the SproutCore Getting started tutorial and have a problem. Inside the Todos.todoListController
Just getting started using MVC in ASP.NET, I'm going to have it so users
I'm just getting started with ASP.NET MVC and am going through the NerdDinner tutorial.
After going through tutorials on getting started with Tortoise I am finally starting to
I have a basic GWT Maven project going. I added SmartGWT and started playing
I have started work on a local app for myself that runs through the
I recently started picking up vi , going through some tutorials and trying to
I have recently started to learn about programming for the iPhone and after going
I have planed to start using a framework in php development. After going through
I am going through a bit of a design dilemma, I have been targeting

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.