1

C code:

write(3, "str", sizeof("str") - 1);

Usage: ./a.out 3>/dev/stdout

How to achieve the same functionality in Python? From documentation I should call open function and use given file descriptor. But what if I already have it?

Alex
  • 1,047
  • 8
  • 21

1 Answers1

1

You should be able to do something similar in python. See this SO answer for a more detailed description.

It'll look something like:

yourfd = open(3, "w")
yourfd.write("str")
yourfd.close()
Damon Snyder
  • 1,362
  • 1
  • 11
  • 18