Differences
This shows you the differences between two versions of the page.
gethostname [2021/04/05 11:23] |
gethostname [2021/04/05 11:23] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Get Hostname ====== | ||
+ | <sxh> | ||
+ | |||
+ | **FREE | ||
+ | |||
+ | ctl-opt dftactgrp(*no) actgrp(*caller); | ||
+ | |||
+ | |||
+ | dcl-pr gethostname int(10) extproc(' | ||
+ | name pointer value; | ||
+ | length int(10) value; | ||
+ | end-pr; | ||
+ | |||
+ | |||
+ | main(); | ||
+ | *inlr = *on; | ||
+ | |||
+ | |||
+ | dcl-proc main; | ||
+ | dcl-s name char(50); | ||
+ | dcl-s rc int(10); | ||
+ | |||
+ | rc = gethostname(%addr(name) : %size(name)); | ||
+ | dsply %char(rc); | ||
+ | |||
+ | name = %str(%addr(name)); | ||
+ | dsply name; | ||
+ | |||
+ | end-proc; | ||
+ | |||
+ | </ | ||
+ | |||
+ | {{tag> |