func Fscanf(f *File, format []byte, args ...interface{}) int32 {
	realArgs := prepareArgsForScanf(args)
	goFormat := CStringToString(format)
	iter := 0
again:
	n, err := fmt.Fscanf(f.OsFile, goFormat, realArgs...)
	if err != nil {
		if strings.Contains(err.Error(), "unexpected newline") && iter < 100 {
			iter++
			goto again
		}
		return -1
	}
	finalizeArgsForScanf(realArgs, args)
	return int32(n)
}
Fscanf handles fscanf().

Reads data from the stream and stores them according to the parameter format
into the locations pointed by the additional arguments.

The additional arguments should point to already allocated objects of the
type specified by their corresponding format specifier within the format
string.
package noarch
import (
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"reflect"
	"strings"
)
var (
	Stdin  = NewFile(os.Stdin)
	Stdout = NewFile(os.Stdout)
	Stderr = NewFile(os.Stderr)
)
type File struct {
	OsFile *os.File
}
func Fopen(filePath, mode []byte) *File {
	var file *os.File
	var err error
	sFilePath := CStringToString(filePath)
	switch CStringToString(mode) {
	case "r":
		file, err = os.OpenFile(sFilePath, os.O_RDONLY, 0655)
	case "r+":
		file, err = os.OpenFile(sFilePath, os.O_RDWR, 0655)
	case "a":
		file, err = os.OpenFile(sFilePath, os.O_WRONLY|os.O_APPEND, 0655)
	case "a+":
		file, err = os.OpenFile(sFilePath, os.O_RDWR|os.O_APPEND, 0655)
	case "w":
		file, err = os.OpenFile(sFilePath, os.O_RDWR|os.O_CREATE, 0655)
	case "w+":
		file, err = os.OpenFile(sFilePath, os.O_RDWR|os.O_CREATE, 0655)
	default:
		panic(fmt.Sprintf("unsupported file mode: %s", mode))
	}
	if err != nil {
		return nil
	}
	return NewFile(file)
}
func Fclose(f *File) int32 {
	err := f.OsFile.Close()
	if err != nil {
		return 1
	}
	return 0
}
func Remove(filePath []byte) int32 {
	if os.Remove(CStringToString(filePath)) != nil {
		return -1
	}
	return 0
}
func Rename(oldName, newName []byte) int32 {
	from := CStringToString(oldName)
	to := CStringToString(newName)
	if os.Rename(from, to) != nil {
		return -1
	}
	return 0
}
func Fputs(str []byte, stream *File) int32 {
	if stream == nil {
		return -1
	}
	s := CStringToString(str)
	n, err := stream.OsFile.WriteString(s)
	if err != nil {
		panic(err)
	}
	return int32(n)
}
func Tmpfile() *File {
	f, err := ioutil.TempFile("", "")
	if err != nil {
		return nil
	}
	return NewFile(f)
}
func Fgets(str []byte, num32 int32, stream *File) []byte {
	num := int(num32)
	buf := make([]byte, num)
	n, err := stream.OsFile.Read(buf)
	if err != nil {
		return []byte{}
	}
	if n == num {
		return buf[:n-1]
	}
	return buf[:n]
}
func Gets(str []byte) []byte {
	_, err := Stdin.OsFile.Read(str)
	if err != nil {
		return []byte{}
	}
	return str
}
func Rewind(stream *File) {
	stream.OsFile.Seek(0, 0)
}
func Feof(stream *File) int32 {
	buf := make([]byte, 1)
	_, err := stream.OsFile.Read(buf)
	result := 0
	if err == io.EOF {
		result = 1
	}
	stream.OsFile.Seek(-1, 1)
	return int32(result)
}
func NewFile(f *os.File) *File {
	return &File{
		OsFile: f,
	}
}
func Tmpnam(str []byte) []byte {
	f, err := ioutil.TempFile("", "")
	if err != nil {
		return []byte{}
	}
	f.Close()
	return []byte(f.Name())
}
func Fflush(stream *File) int32 {
	err := stream.OsFile.Sync()
	if err != nil {
		return 1
	}
	return 0
}
func Fprintf(f *File, format []byte, args ...interface{}) int32 {
	realArgs := []interface{}{}
	typeOfByteSlice := reflect.TypeOf([]byte(nil))
	for _, arg := range args {
		if reflect.TypeOf(arg) == typeOfByteSlice {
			realArgs = append(realArgs, CStringToString(arg.([]byte)))
		} else {
			realArgs = append(realArgs, arg)
		}
	}
	n, err := fmt.Fprintf(f.OsFile, CStringToString(format), realArgs...)
	if err != nil {
		return -1
	}
	return int32(n)
}