17 lines
529 B
Plaintext

read(fd int, buffer *byte, length int) -> int {
fd = kernel32.GetStdHandle(-10 - fd)
kernel32.ReadConsole(fd, buffer, uint32(length), 0)
return length
}
write(fd int, buffer *byte, length int) -> int {
fd = kernel32.GetStdHandle(-10 - fd)
kernel32.WriteConsoleA(fd, buffer, uint32(length), 0)
return length
}
extern kernel32 {
GetStdHandle(handle int64) -> int64
ReadConsole(fd int64, buffer *byte, length uint32, written *uint32) -> bool
WriteConsoleA(fd int64, buffer *byte, length uint32, written *uint32) -> bool
}