Thread: string to int

  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,130
    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, 08: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, 06:05 PM
  4. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM