File: xlogger.cpp

package info (click to toggle)
marote 2.4-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 556 kB
  • ctags: 224
  • sloc: cpp: 1,925; makefile: 46
file content (34 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// xlogger.cpp
//
// Written by Mike Studer AB6CV
// 2004-12-22
//
#include "xlogger.h"

using namespace std;

// **** Functions ****


int xlogger::sendit(char* message){
        // create the message queue, you need to use 1238 for the key to talk to xlog
        msgid = msgget ((key_t) 1238, 0666 | IPC_CREAT);
        if (msgid == -1)
                {
                        fprintf (stderr, "msgget failed: %s\n", strerror (errno));
                        return(1);
                }

        /* you need to set mtype to 88 */
        msgbuf.mtype = 88;

strcpy (msgbuf.mtext, message);
        if (msgsnd (msgid, (void *) &msgbuf, 1024, 0) == -1){
	 fprintf (stderr, "msgsnd failed: %s\n", strerror (errno));
                return(1);
		}
        else{
               return(0);
	       }
};