1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
17 pub fn atol(x: *u8) -> int;
18 pub fn atoll(x: *u8) -> i64;
22 fn atol(s: ~str) -> int {
23 s.to_c_str().with_ref(|x| unsafe { libc::atol(x as *u8) })
26 fn atoll(s: ~str) -> i64 {
27 s.to_c_str().with_ref(|x| unsafe { libc::atoll(x as *u8) })
32 assert_eq!(atol(~"1024") * 10, atol(~"10240"));
33 assert!((atoll(~"11111111111111111") * 10i64)
34 == atoll(~"111111111111111110"));