--- /dev/null
+# empty file
--- /dev/null
+cdef extern from "stdio.h" nogil:
+ ctypedef struct FILE
+ int printf(char *format, ...)
+ int fprintf(FILE *stream, char *format, ...)
+ int sprintf(char *str, char *format, ...)
+ FILE *fopen(char *path, char *mode)
+ int fclose(FILE *strea)
+ cdef FILE *stdout
+ int scanf(char *format, ...)
--- /dev/null
+
+cdef extern from "stdlib.h" nogil:
+ void free(void *ptr)
+ void *malloc(size_t size)
+ void *realloc(void *ptr, size_t size)
+ size_t strlen(char *s)
+ char *strcpy(char *dest, char *src)
-cdef extern from "stdio.h" nogil:
- ctypedef struct FILE
- int printf(char *format, ...)
- int fprintf(FILE *stream, char *format, ...)
- int sprintf(char *str, char *format, ...)
- FILE *fopen(char *path, char *mode)
- int fclose(FILE *strea)
- cdef FILE *stdout
- int scanf(char *format, ...)
+# Present for backwards compatability
+from libc.stdio cimport *
-
-cdef extern from "stdlib.h" nogil:
- void free(void *ptr)
- void *malloc(size_t size)
- void *realloc(void *ptr, size_t size)
- size_t strlen(char *s)
- char *strcpy(char *dest, char *src)
+# Present for backwards compatability
+from libc.stdlib cimport *
--- /dev/null
+"""
+>>> f()
+'hello'
+"""
+
+from libc.stdio cimport sprintf
+
+def f():
+ cdef char buf[10]
+ sprintf(buf, b'hello')
+ return str((<object>buf).decode('ASCII'))