1 #!/usr/bin/python 2 #coding=utf-8 3 import os,sys,multiprocessing,time 4 try: 5 os.mkfifo('file') 6 except :pass 7 8 9 def read(): 10 try: 11 os.mkfifo('file1') 12 except:pass 13 f=open('file1') 14 while 1: 15 str=f.readline() 16 print str 17 sys.stdout.flush() 18 m=multiprocessing.Process(target=read) 19 m.start() 20 21 22 f1=open('file','w') 23 while 1: 24 str=sys.stdin.readline() 25 f1.write(str) 26 f1.flush()
1 #!/usr/bin/python 2 #coding=utf-8 3 import os,sys,multiprocessing,time 4 try: 5 os.mkfifo('file1') 6 except :pass 7 8 9 def read(): 10 try: 11 os.mkfifo('file') 12 except:pass 13 f=open('file') 14 while 1: 15 str=f.readline() 16 print str 17 sys.stdout.flush() 18 m=multiprocessing.Process(target=read) 19 m.start() 20 21 22 f1=open('file1','w') 23 while 1: 24 str=sys.stdin.readline() 25 f1.write(str) 26 f1.flush()