OS X equivalent to OutputDebugString()?

后端 未结 4 1373
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 14:47

I\'m examining the feasibility of porting an existing Windows MFC control to OS X/Carbon. My test bed is a C++ Carbon application generated using the XCode 3 Wizard.

I\

4条回答
  •  失恋的感觉
    2021-02-07 15:04

    You might want to look into syslog since it is the de facto diagnostic method on UNIX-based systems. Something like:

    #include 
    
    /* Do this early on in your program like at the beginning of main() */
    openlog("MYPROGRAM", 0, LOG_USER);
    
    /* Use this to log something */
    syslog(LOG_DEBUG, "%s %s", "Hello", "World");
    
    /* Do this somewhere before you exit if you being are pedantic */
    closelog();
    

    Google syslog for more information. You will also have to twiddle some bits in syslog.conf to direct the output to a log or console. Then you can view the output in a terminal window or using the Console application.

提交回复
热议问题