0
|
1 from pydc import *
|
5
|
2 import sys
|
|
3 import platform
|
0
|
4
|
5
|
5 if sys.platform == "win32":
|
0
|
6 libc = load("msvcrt")
|
5
|
7 elif sys.platform == "darwin":
|
0
|
8 libc = load("/usr/lib/libc.dylib")
|
5
|
9 elif "bsd" in sys.platform:
|
|
10 libc = load("/usr/lib/libc.so")
|
|
11 elif platform.architecture()[0] == "64bit":
|
|
12 libc = load("/lib64/libc.so.6")
|
0
|
13 else:
|
|
14 libc = load("/lib/libc.so.6")
|
|
15
|
|
16 fp_atoi = find(libc,"atoi")
|
|
17 fp_atof = find(libc,"atof")
|
|
18
|
5
|
19
|
|
20
|
0
|
21 def atoi(s): return call(fp_atoi,"p)i",s)
|
|
22 def atod(s): return call(fp_atof,"p)d",s)
|
|
23
|
|
24 print atoi( "3".join(["12","45"]) )
|
|
25 print atod( "3".join(["12","45"]) )
|
|
26
|