標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
z/OS®UNIX | 両方 |
#include <sys/__messag.h>
int __console(struct __cons_msg *cons, char *modstr, int *concmd);
__console() 関数は、オペレーターのコンソールと通信を行うときに 使用します。__console() 関数により、ユーザーは、オペレーターのコンソールに メッセージを送信したり、コンソールからの変更/停止要求を待機することが できます。
struct __cons_msg {
short __reserved0;
char __reserved1[2];
union {
struct {
int __msg_length;
char *__msg;
char __reserved2[8];
} __f1;
} __format;
};
正常に実行された場合、__console() は 0 を戻します。
CELEBC41
⁄* CELEBC41
This example prints a simple message to the console using the
__console() function.
*⁄
#include <sys⁄__messag.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char** argv) {
struct __cons_msg cmsg;
char buf[256] = "A message on the console";
int rc;
int cmsg_cmd = 0;
⁄* fill in the __cons_msg structure *⁄
cmsg.__format.__f1.__msg = buf;
cmsg.__format.__f1.__msg_length = strlen(buf);
rc = __console(&cmsg,NULL,&cmsg_cmd);
if(rc == -1) {
printf("__console() failed¥n");
printf("%s¥n",strerror(errno));
}
else {
printf("__console() successful. Check console for message.¥n");
}
return 0;
}