Skip to content

Instantly share code, notes, and snippets.

View thatstoasty's full-sized avatar

Mikhail Tavarez thatstoasty

View GitHub Profile
@thatstoasty
thatstoasty / stdin.mojo
Created August 14, 2024 20:30
Reading from stdin using mojo and recreating the Python input function
from builtin.io import _dup
from memory import UnsafePointer, memcpy
from sys import os_is_windows, external_call
@value
struct stdin:
"""A read only file handle to the stdin stream."""
alias file_descriptor = 0