[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

C RMS file I/O keywords? (creat, fopen)

» close window

The Question is:

 
How to create a file with FAB$V_FTN using create() call in C program?
 
I want create a file with attribure as fab$V_FTN bit 0 .
Can you tell me  hot to give this  option in C program
Create() statement?
 
Thx in advance...
 
regards
Nagaraj Hegde
 


The Answer is :

 
  The OpenVMS Wizard would be somewhat hesitant to recommend
  the use of the C UNIX file I/O emulation routines for file
  formats not typically found on UNIX.  While this is generally
  possible via the mechanism and options documented on the C
  creat() call, the OpenVMS Wizard would not consider it the
  most obvious approach.  (C tends to layer its own expectations
  onto the file open operation, which is certainly not unexpected.
  This layering can, however, sometimes have unexpected results.)
 
  The OpenVMS Wizard would tend to use direct calls to the OpenVMS
  RMS services.  This provides specific control, and is -- once
  you have an example or two to work from -- nearly as easy.  With
  the RMS calls, you will get exactly what you ask for, as well.
  Existing RMS C examples are posted in topics 367, 1334, 1550,
  and 2608.  Other example calls are also available in the OpenVMS
  Freeware and elsewhere.
 
  But if you insist, the C keyword is "rat=ftn".
 
  Here is an example:
 
    #include <stdio.h>
    #include <ssdef.h>
    main()
      {
      int RetStat;
      FILE *fd;
      fd = fopen("SYS$SCRATCH:X.TMP", "w", "rat=ftn");
      if (fd == NULL)
        {
        perror("fopen failure");
        return SS$_BUGCHECK;
        }
      fprintf( fd, "Hello, I must be going" );
      fclose( fd );
      return SS$_NORMAL;
      }
 

answer written or last revised on ( 27-OCT-1999 )

» close window