iphone - Stdout redirection not working in iOS without debugger -


i trying redirect output can send on network. reason if run code while debugger attached works perfectly. once start application in normal way code freezes on read function , never returns. if has pointers highly appreciate it.

dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_low, 0), ^(void) {             static int pipepair[2];             if ( pipe(pipepair) != 0) {                 return;             }             dup2(pipepair[1],stdout_fileno);             while (true) {                 char * buffer = calloc(sizeof(char), 1024);                 ssize_t readcount = read(pipepair[0],buffer,1023);                 if (readcount > 0) {                     buffer[readcount] = 0;                     nsstring * log = [nsstring stringwithcstring:buffer encoding:nsutf8stringencoding];                     //sent on network                 }                  if (readcount == -1) {                     return;                 }             }         }); 

apparently in ios 5.1 writing stdout disallowed. http://spouliot.wordpress.com/2012/03/13/ios-5-1-vs-stdout/


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -