[comp.os.vms] VAX C! Help me!!

manes@xanth.UUCP (Mark Manes) (11/11/87)

I have a problem folks, I have just installed VAX C, on VMS 4.6.

I want to call LIB$SPAWN and can't find a decent example, this program
that I am uploading does not work, however does compile, would someone
be so kind as to show me where I have messed up?

Thanks.

#include <stdio.h>
#include <descrip.h>
#include <ssdef.h>
 
 
/* declarations for LIB$SPAWN Run-time Library Call */
 
char command_text[80] = "SHOW USERS";
$DESCRIPTOR (command_text_ptr, command_text);
char input_file = NULL;
char output_file[10] = "disk.dat";
unsigned long int status;
 
main()
{  
 
printf("Attempting execution of %s\n",command_text);
 
status = LIB$SPAWN(command_text, input_file, output_file);
 
if (status != 0) 
  {        
  printf("Command Failed %d\n",status);
  exit(FALSE);
  }
 
}
 

barsh@stsci.UUCP (11/12/87)

in article <3297@xanth.UUCP>, manes@xanth.UUCP (Mark Manes) says:
> 
> I have a problem folks, I have just installed VAX C, on VMS 4.6.
> 
> I want to call LIB$SPAWN and can't find a decent example, this program
> that I am uploading does not work, however does compile, would someone
> be so kind as to show me where I have messed up?



The following is a working example:

#include <stdio.h>
#include <descrip.h>
#include <ssdef.h>
 
main()
{  
	$DESCRIPTOR (command_text, "show users");
	$DESCRIPTOR (output_file, "disk.dat");
	int	status;
 
	if ((status = LIB$SPAWN(&command_text, 0, &output_file)) != SS$_NORMAL)
	  printf("Command Failed %d\n",status);
 
}
 
					jrbii
					~~~~~