title: Redirecting printf on iOS to user interface
body: <p>I'm new to iOS development (and Obj-C), and I'm trying to port an existing C program to iOS.</p>
  
  <p>The C program usually runs in the console, but I want to make a UI for it on the iPhone. I've already ported the C code, and when the simulator is run I can get the printf output in the console window. I want to avoid changing the original code as much as possible, so this is my plan:</p>
  
  <ol>
  <li>The program takes some time to execute, so I think I need to run it on a seperate thread. It look likes I'll only need an NSInvocationOperation to call it's main method.</li>
  <li>I will redirect stdout to a pipe.</li>
  <li>On another thread, I will read from the pipe, and throw this to the UI. I'm not sure what might be the best concurrancy API to use for this.</li>
  </ol>
  
  <p>Is this a good strategy for the iOS, or is there a better alternative for porting this? Are there any pitfalls I should look out for?</p>