Including OS-specific code

If you need to include OS-specific code in your application, you can wrap it in an #ifdef to make the program more portable.

The qcc utility defines these preprocessor symbols (or manifest constants):

The target is a QNX operating system (QNX 4, QNX Neutrino, or BlackBerry 10 OS).
The target is the QNX Neutrino RTOS or BlackBerry 10 OS.

For example:

#if defined(__QNX__)
   /* QNX-specific (any flavor) code here */

   #if defined(__QNXNTO__)
      /* QNX Neutrino-specific code here */
      /* QNX 4-specific code here */

For information about other preprocessor symbols that you might find useful, see the Manifests chapter of the QNX Neutrino C Library Reference.