Timothy McDowell
Timothy McDowell

Reputation: 237

Putting a 'terminal' in my application?

Are there any frameworks for say, putting a display like in Terminal.app in MY app, and then displaying text on it like usual output to STDOUT? Complete with scrollback and etc.?

Upvotes: 7

Views: 1171

Answers (2)

Barry Wark
Barry Wark

Reputation: 107774

You may want to look at iTerm, an open-source terminal emulator written in Cocoa. If you really want terminal emulation, you might be able to lift from that framework.

Upvotes: 4

plinth
plinth

Reputation: 49209

This thread has a couple suggestions. The first is very UNIX'y - you use pipe() to map stdout to a new location. Then you'd need another process or a thread that reads that pipe and displays it into an NSTextView. The other approach that I liked as it seems cleaner and less resource intensive is to replace the File_writer_t _write proc in the stdout() FILE pointer with the hook that you want, which write the output into an NSTextView.

Upvotes: 3

Related Questions