from libc.math cimport sin
from libc.string cimport strcmp
from libc.stdio cimport fopen,fclose,fgets,fseek,ftell,fwrite
def main():
cdef int a=1
cdef char* s = "Hello マリオさん。こんにちは"
cdef list l = [1,2,3,4,5]
cdef dict d = {"one":1,"two":2}
cdef tuple t = (1,2)
cdef set se = {"one","two","three"}
fin = fopen("add.pyx","r")
if not fin:
print "読み込みミスった"
cdef char str[1000]
fseek(fin, 0L, 1);
while fgets(str,256,fin) != NULL:
print str
fclose(fin)
fout = fopen("output.txt","w")
if not fout:
print "読み込みミスった"
fwrite(s, sizeof(char), len(s), fout);
fclose(fout)
参考URL
Cython ドキュメント(和訳) — Cython 0.17.1 documentation