हाय: मैं stdout को NSTextView पर रीडायरेक्ट करना चाहता हूं। क्या यह सबप्रोसेसेस के आउटपुट के साथ भी काम कर सकता है? इसे प्राप्त करने का सबसे अच्छा तरीका क्या हो सकता है?कोको में stdout को NSTextView पर रीडायरेक्ट करने का सबसे अच्छा तरीका क्या है?
संपादित करें: पीटर होसे के उत्तर के अनुसार मैंने निम्नलिखित लागू किए। लेकिन मुझे अधिसूचना नहीं मिली है। मैं क्या गलत कर रहा हूं?
NSPipe *pipe = [NSPipe pipe];
NSFileHandle *pipeHandle = [pipe fileHandleForWriting];
dup2(STDOUT_FILENO, [pipeHandle fileDescriptor]);
NSFileHandle *fileHandle = [[NSFileHandle alloc] initWithFileDescriptor:pipeHandle];
[fileHandle acceptConnectionInBackgroundAndNotify];
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
[dnc addObserver:self selector:@selector(handleNotification:) name:NSFileHandleConnectionAcceptedNotification object:fileHandle];
पाइथन को इसके साथ क्या करना है? – Eimantas
@Eimantas: आप सही हैं, यह सीधे सवाल से संबंधित नहीं है। असल में मैं पायओबेज का उपयोग कर पाइथन कोड लेखन के साथ संवाद करने के लिए ** stdout ** जो मैं प्रदर्शित करना चाहता हूं। मुझे टैग को हटा देना चाहिए ... – Sney