string to int

This is a discussion on string to int within the Windows Programming forums, part of the Platform Specific Boards category; Is there any win32 api function to retrieve an int from a string?...

  1. #1
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125

    Question string to int

    Is there any win32 api function to retrieve an int from a string?
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    I'm not sure of an api function, but it can be done with stdio.h. Just get the string and then sscanf the string. The parameters would be:

    sscanf(string, "%d", &newint);

    But, I'm not sure of an api function.

    --Garfield
    1978 Silver Anniversary Corvette

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    Use

    int atoi( const char* )

    it's ANSI standard I think. Should be in one of the c headers.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 07:19 AM
  2. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  3. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 05:05 PM
  4. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21