I have a code to read stdin as binary file in linux:
#! /usr/bin/python3
stdin_file = '/dev/stdin'
def read_input():
with open(stdin_file, mode='rb') as f:
while True:
inp = f.read(4)
if not inp: break
print('got :' , inp)
read_input()
what could be its alternative for windows OS?
I dont want to use sys.stdin.buffer.read()
Consider it as it is compulsary for me to use it like open(file_name)