(import "msvcrt.dll")

(usefun "malloc" "pointer")
(usefun "free" "void")
(usefun "strcpy" "int")
(usefun "printf" "int")
(usefun "fopen" "pointer")
(usefun "fclose" "void")
(usefun "fgets" "int")
(usefun "feof" "int")
(usefun "memset" "int")

(print "fopen..\n")
(set fp (fopen "temp2.txt" "r"))
(cond ((not (feof fp))) (
   (print "malloc..\n")
   (set buffer (malloc 1024))
   (print "memset..\n")
   (memset buffer 0 1024)
   (print "fgets..\n")
   (fgets buffer 100 fp)
   (print "printf..\n")
   (printf buffer)
   (print "free..\n")
   (free buffer)
   (print "fclose..\n")
   (fclose fp)
   (print "done..\n")
))
