strtol()
converts a string to an integer, a long integer but an integer nevertheless. There is atoi()
but it should be avoided in most cases due to the fact that it lacks a mechanism for error reporting from invalid input.
More Related Contents:
- C read file line by line
- stdlib and colored output in C
- Is malloc/free a syscall or a library routine provided by libc?
- Compiling without libc
- What is the rationale for fread/fwrite taking size and count as arguments?
- Is snprintf() ALWAYS null terminating?
- How do I reimplement (or wrap) a syscall function on Linux?
- How to link to a different libc file?
- Linux function to get mount points
- Should C compilers immediately free "further unused" memories? [closed]
- how many bytes is this struct? – how many bytes is pointer to a struct? [closed]
- Why does printf not flush after the call unless a newline is in the format string?
- Why is the use of alloca() not considered good practice?
- Using LEA on values that aren’t addresses / pointers?
- Display an array of color in C [closed]
- Atomicity of `write(2)` to a local filesystem
- Rand Implementation
- Does unaligned memory access always cause bus errors?
- Pass a two dimensional array to a function of constant parameter
- XML Parser for C [closed]
- Explain this implementation of malloc from the K&R book
- Need to know when no data appears between two token separators using strtok()
- How can I avoid “duplicate symbol” errors in xcode with shared static libraries?
- C: How can I make it so scanf() input has one of two formats?
- What does a dot before the variable name in struct mean?
- How to define and work with an array of bits in C?
- Memory map for a 2D array in C
- How do you check if a directory exists on Windows in C?
- C Function to Convert float to byte array
- Efficient way to find task_struct by pid