![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: Excuse my ignorance, but I am new to this. With Dec C 5.5, how can I pass argv to a descriptor? Thank you. The Answer is : Please see the OpenVMS Frequently Asked Questions (FAQ) for information on string descriptors. See the attached example for details of one way to "convert" from a null-terminated string (ASCIZ) over to a static string descriptor (ASCID) string. -- #include <descrip.h> #include <lib$routines.h> #include <ssdef.h> #include <stdio.h> #include <string.h> #include <stsdef.h> #define TEXTBUFLEN 32 main( int argc, char **argv ) { int RetStat; struct dsc$descriptor TextDsc = { TEXTBUFLEN, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL }; char TextBuf[TEXTBUFLEN]; if ( argc != 2 ) { printf("this is a foreign command; usage: argc text\n"); return SS$_BADPARAM; } sscanf( argv[1], "%32s", TextBuf ); TextDsc.dsc$w_length = strlen( TextBuf ); TextDsc.dsc$a_pointer = TextBuf; RetStat = lib$put_output( &TextDsc ); if (!$VMS_STATUS_SUCCESS( RetStat )) return RetStat; return RetStat; }
|