Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / IPC_SAP / FIFO_SAP / FIFO-Msg-client.cpp
blob65025e07ba2d42cb9872e8ee1fde0e7dcbcc7e3e
1 #include "ace/FIFO_Send_Msg.h"
2 #include "ace/OS_NS_stdio.h"
3 #include "ace/OS_main.h"
4 #include "ace/OS_NS_stdlib.h"
5 #include "ace/OS_NS_time.h"
6 #include "ace/OS_NS_string.h"
9 #if defined (ACE_HAS_STREAM_PIPES)
11 int
12 ACE_TMAIN (int, ACE_TCHAR *[])
14 ACE_FIFO_Send_Msg client (ACE_DEFAULT_RENDEZVOUS);
16 char buf[BUFSIZ];
17 ACE_Str_Buf msg (buf);
19 ACE_OS::srand (unsigned (ACE_OS::time (0)));
21 while (ACE_OS::fgets (buf, sizeof buf, stdin) != 0)
23 msg.len = ACE_OS::strlen (buf) + 1;
24 if (client.send (ACE_OS::rand () % 11, &msg) == -1)
25 ACE_OS::perror ("send");
28 if (client.close () == -1)
29 ACE_OS::perror ("close"), ACE_OS::exit (1);
31 return 0;
33 #else
34 #include "ace/os_include/os_stdio.h"
35 int ACE_TMAIN (int, ACE_TCHAR *[])
37 ACE_OS::fprintf (stderr, "This feature is not supported\n");
38 return 0;
40 #endif /* ACE_HAS_STREAM_PIPES */