Article 161024 of comp.os.vms:
Marty Bigos wrote:
> 
> Binary i/o using create map section system call appears to run much faster than
> C standard i/o. I would like to write a little library for reading/writing
> binary files using this technique, but I find the system service documentation
> to be a little terse. If anyone is willing to share some code in C (or in
> another high level language) that would aid in my understanding, I would
> appreciate it very much.
> 
> -Marty Bigos
> bigos@stanford.edu

-- 

Here is an example in C. It creates a process-private, read-only
section. The contents of MY_FILE.DAT may be further accessed through the
virtual address range returned in array retadr.

--------------------

#include <starlet.h>
#include <rms.h>
#include <secdef.h>

char nambuf [] = "MY_FILE.DAT";

short chan;

int stat, inadr [2] = {0,0}, retadr [2];

struct FAB my_fab;

my_fab = cc$rms_fab;
my_fab.fab$l_fna = nambuf;
my_fab.fab$b_fns = strlen (nambuf);
my_fab.fab$l_fop = FAB$M_UFO;
my_fab.fab$b_rtv = -1;
my_fab.fab$b_shr = FAB$M_UPI;

if ((stat = sys$open (&my_fab,0,0)) != RMS$_NORMAL) return stat;

chan = (short) my_fab.fab$l_stv;

stat = sys$crmpsc (inadr,retadr,0,SEC$M_EXPREG,0,0,0,chan,0,0,0,0);

if (stat != SS$_NORMAL && stat != SS$_CREATED) return stat;

-------------------------------------------

If you need more info, let me know.

						Greetings, Ferry


Ing. Ferry Bolhár-Nordenkampf
Magistrat der Stadt Wien (MA-14)        A - 1010 Vienna (Austria)
Phone: 0222/4000/98632                  E-Mail: bol@adv.magwien.gv.at

"Wenn hier einer schuld ist, dann immer nur der Computer."


