Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!lucy.wellesley.EDU!sshurr From: sshurr@lucy.wellesley.EDU (Scott) Newsgroups: comp.os.vms Subject: re: using the $trnlnm system service from c Message-ID: <8801220106.AA15516@ucbvax.Berkeley.EDU> Date: 20 Jan 88 15:11:20 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 47 > Its friday and maybe thats why I can't figure this out but maybe > someone else can help. I am trying to use the system service sys$trnlnm > to translate a logical name. However, how to define the struct for the > itemlst eludes me. All I want to do is have in my hot little hands a > pointer to a string containing the translated logical. Can anyone > help? Try the program as follows: #include stdio #include ssdef /* the system reurn codes */ #include descrip /* the descriptor definitions */ #include lnmdef struct itm { short buffer_length; short item_code; long buffer_address; long r_len_address; }; struct itmlist { struct itm itemname; long terminator; }; /* translate the give logical name and print the translation */ main() { int sys$trnlnm(); $DESCRIPTOR(Log_nam,"EDTINI"); $DESCRIPTOR(Tab_nam,"LNM$PROCESS_TABLE"); char somestringpointer[80]; int stringsize; long status; struct itmlist itemlst = {79, LNM$_STRING, somestringpointer, &stringsize, 0}; status = sys$trnlnm(NULL,&Tab_nam,&Log_nam,NULL,&itemlst); if (status!=SS$_NORMAL) exit(status); somestringpointer[stringsize] = '\0'; printf("%s\n",somestringpointer); }