Write binary data to standard error?

S

sapsi

Hello,
This is probably a basic question, but how does one write binary data
to standard error e.g int as network order (4 bytes)?

Much thanks
Saptarshi
 
S

Saptarshi

Hello,
This is probably a basic question, but how does one write binary data
to standard error e.g int as network order (4 bytes)?

Much thanks
Saptarshi

Solved:
import sys
import os
from struct import *

d=os.fdopen(sys.stderr.fileno(),"wb")
d.write("\x00")
d.write(pack(">i",5))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,249
Latest member
KattieCort

Latest Threads

Top