Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

atoi(3) [linux man page]

ATOI(3) 						     Linux Programmer's Manual							   ATOI(3)

NAME
atoi, atol, atoll, atoq - convert a string to an integer SYNOPSIS
#include <stdlib.h> int atoi(const char *nptr); long atol(const char *nptr); long long atoll(const char *nptr); long long atoq(const char *nptr); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): atoll(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L; or cc -std=c99 DESCRIPTION
The atoi() function converts the initial portion of the string pointed to by nptr to int. The behavior is the same as strtol(nptr, (char **) NULL, 10); except that atoi() does not detect errors. The atol() and atoll() functions behave the same as atoi(), except that they convert the initial portion of the string to their return type of long or long long. atoq() is an obsolete name for atoll(). RETURN VALUE
The converted value. CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD, C99. C89 and POSIX.1-1996 include the functions atoi() and atol() only. atoq() is a GNU extension. NOTES
The nonstandard atoq() function is not present in libc 4.6.27 or glibc 2, but is present in libc5 and libc 4.7 (though only as an inline function in <stdlib.h> until libc 5.4.44). The atoll() function is present in glibc 2 since version 2.0.2, but not in libc4 or libc5. SEE ALSO
atof(3), strtod(3), strtol(3), strtoul(3) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2010-09-20 ATOI(3)

Check Out this Related Man Page

ATOI(3) 						     Linux Programmer's Manual							   ATOI(3)

NAME
atoi, atol, atoll, atoq - convert a string to an integer SYNOPSIS
#include <stdlib.h> int atoi(const char *nptr); long atol(const char *nptr); long long atoll(const char *nptr); long long atoq(const char *nptr); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): atoll(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L; or cc -std=c99 DESCRIPTION
The atoi() function converts the initial portion of the string pointed to by nptr to int. The behavior is the same as strtol(nptr, NULL, 10); except that atoi() does not detect errors. The atol() and atoll() functions behave the same as atoi(), except that they convert the initial portion of the string to their return type of long or long long. atoq() is an obsolete name for atoll(). RETURN VALUE
The converted value. CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD, C99. C89 and POSIX.1-1996 include the functions atoi() and atol() only. atoq() is a GNU extension. NOTES
The nonstandard atoq() function is not present in libc 4.6.27 or glibc 2, but is present in libc5 and libc 4.7 (though only as an inline function in <stdlib.h> until libc 5.4.44). The atoll() function is present in glibc 2 since version 2.0.2, but not in libc4 or libc5. SEE ALSO
atof(3), strtod(3), strtol(3), strtoul(3) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2012-08-03 ATOI(3)
Man Page

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

applicatoin cannot started, becos daemon did not run

hi, i had an applicatoin which is not running cos one of its daemon is not running.. i get the applicatoin to run by running the daemon first... its manual job... so quite cumbersome.. i have backups in the night, with the crontab -l entry with logs written. the logs indicated successful... (7 Replies)
Discussion started by: yls177
7 Replies

2. Programming

atoi

i know what is the use of atoi function.... converts string to int. but whenever i use that it gives me 0.... could any one help in this issue.. eg. int i; char str; str="name"; i=atoi(str); i gives me 0. why? (3 Replies)
Discussion started by: bankpro
3 Replies

3. Shell Programming and Scripting

Dynamic Log Deletion/Rotatoin Script

I've written a small static script for my log deletion, but I was wondering if there was a way to make it a dynamic script. here is how my script currently works. #!/bin/sh ########################################### #Script to zip logs older than 1 week old #and to delete logs older than 30... (3 Replies)
Discussion started by: cbo0485
3 Replies

4. Programming

why the implementatoin of Bakery algorithm in ANSI C does not work in ANSI C

I follow the description of wiki (Lamport's bakery algorithm - Wikipedia, the free encyclopedia), then implement that algorithm in C, but it doesn't work, Starving is still here, is the implementation worry? Only print out: Thread ID: 0 START! Thread ID: 0 END! Thread ID: 0 START!... (2 Replies)
Discussion started by: sehang
2 Replies

5. Programming

help with atoi and macros in C

I have a PORT_NUM macro (10 digits long number) in a server file, if i do htons(PORT_NUM) i get warning: this decimal constant is unsigned only in ISO C90 warning: large integer implicitly truncated to unsigned type whats wrong with this? (2 Replies)
Discussion started by: omega666
2 Replies

6. Programming

type conversion C, atoi()

In the book "The C programming language"; second edition, chapter 2.7 there is a snippet which is supposed to: "convert a string of digits into its numeric equivalent". int atoi(char s) { int i, n; n = 0; for ( i = 0; s >= '0' && s <= '9'; ++i) n = 10 * n + (s -... (4 Replies)
Discussion started by: tornow
4 Replies

7. Red Hat

Cant Access Applicatoin GUI Remotely (SSH)

Greetings! Theres an application in my RHEL 6 server that has a GUI (which we'd like to use). When I run the AppGui.sh is says it needs Server X11. I know its gotta do something with X server (and I installed it).I found some tutorial for auto configuration and then I was supposed to access... (0 Replies)
Discussion started by: RedSpyder
0 Replies

8. Solaris

Network interface showing wrong configuratoin

on both of my T2000 I am seeing same values of 100Mbps for e1000g0 ethernet port. i know all four ethernet ports on T2000 are gigabit ports so why is my first link showing as 100Mbps and how can i correct it? # dladm show-dev e1000g0 link: up speed: 100 Mbps ... (1 Reply)
Discussion started by: aliyesami
1 Replies