0

I've written the following code:

#include <sys/timerfd.h>
#include <ctime>
#include <inttypes.h>
#include <unistd.h>
#include <stdio.h>

int main()
{
    printf("Test_message");
    int tfd;
    uint64_t count;
    tfd= timerfd_create(CLOCK_MONOTONIC,0);
    itimerspec itimer;
    itimer.it_interval={1,0};
    itimer.it_value={1,0};
    timerfd_settime(tfd,0,&itimer,NULL);
    while(true)
    {
        read(tfd, &count, sizeof(count));
    }
}

When I'm compiling and linking we have no output to console. But I'm expected that the Test_message will be printed.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

0
  1. Run the program.
  2. Do not forget buffering - "Test message" will be their until it is flushed. See fflush
Ed Heal
  • 59,252
  • 17
  • 87
  • 127