Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    The Sillicon Valley, California

    how is atoi() done in the kernel?

    So, atoi is not in the kernel.

    Is there a workaround?

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    not in the kernel?

    are you trying to use this in a C program? If you are, the kernel is not responsible for supplying libraries for non kernel apps. you need to inclue the cstdlib.h header file.

    cstdlib (stdlib.h) - C++ Reference

    it is a C++ site, but it includes the legacy library references. you need to include the cstdlin.h header into your source file, and then you can use atoi() in your program.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  3. #3
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    NH, USA
    i'm guessing the OP is trying to write a kernel code, and needs the functionality of atoi. Probably you can't include stdlib.h in a kernel module, thus the problem.

  4. $spacer_open
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    There is a function simple_strtol() defined in kernel.h which you can use in place of atoi().
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #5

    kernel API...

    To those new people trying to find their way through the Kernel API....

    If you have a look at the README file in the top directory of the Linux kernel source, you will find a reference to "DOCUMENTATION". It refers you to the directory under that current directory of "Documentation/DocBook". In that directory are instructions of how to generate the html or PDF files that describe the Kernel API which also lists the "simple_strtoll()" function along with many other useful functions. If you are writing a kernel module, you should really become acquainted with the kernel API. I derive a lot of amusement reviewing someones code after they have written a bunch of linked list functions AGAIN!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts