sleep in a while loop is failing on qnx 6.3.0

Why isn’t the following program displaying anything ??

#include <unistd.h> /* For sleep */
#include <stdio.h>

int main (int argc, char **argv)
 {
 unsigned int res;
 while (1)
       {
       printf("O");
       res=sleep(2); 
       }
}

It works removing the “sleep(2);”
Compiled and runned with qnx 6.3.0 and qnx 6.3.0 sp2, on 2 computers.

Compiled from Qnx host with qcc test.c -o test, and from the Ide at a Windows Host.

printf is buffered, as discussed in this thread. You could try to flush it:

#include <unistd.h> /* For sleep */
#include <stdio.h>

int main (int argc, char **argv)
 {
 unsigned int res;
 while (1)
       {
       printf("O");
       fflush(stdout);
       res=sleep(2);
       }
} 

Ok, thank you.