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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:48:41+00:00 2026-05-26T11:48:41+00:00

I have an input argument string const char* s I know that it starts

  • 0

I have an input argument string const char* s
I know that it starts the sequence of chars which are integers representation ,this sequence could be of any length ,including 0.
After the integer sequence follows sequence of chars which are not integer representation.
for example "23meeting","1h".
Is there some (builtin) C function which can extract the integer?
For example for “23meeting” such operation could be performed :

int x = needed_function("23meeting"); //results x = 23

Thanks

  • 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-26T11:48:41+00:00Added an answer on May 26, 2026 at 11:48 am

    atoi() should work fine for this. It should stop at the first non-numeric character.

    int x = atoi("23meeting")
    

    EDIT: A comment implies that atoi() is not thread safe or is deprecated from the language. There is some discussion of the thread safety of this function here:

    Why does OSX document atoi/atof as not being threadsafe?

    Can someone provide a reference to atoi not being thread safe?

    And as far as I can tell atoi() is in C99 which is the latest standard (7.20.1.2).

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

Sidebar

Related Questions

Suppose I have a simple program which takes argument input in one of the
I have a function whose input argument can either be an element or a
I have a perl program that takes input and output file arguments, and I'd
I have input fields, which I process with AJAX and send it on another
How to rewrite Webconfig connection string at runtime.I have input textbox for Server,UserName and
We have some input data that sometimes appears with &nbsp characters on the end.
I have an input which at some points happens to have the focus. If
I have problem on processing input request parameter (of course it's type String) to
How can I use string argument input as a part of variable name in
this is the code that i have found in the internet for reading the

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.