Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!njin!princeton!udel!gatech!purdue!umd5!ames!pasteur!ucbvax!BGERUG51.BITNET!PVR
From: PVR@BGERUG51.BITNET
Newsgroups: comp.os.vms
Subject: HELP ME: VAX VMS C fopen() problem with binary files
Message-ID: <8806221601.AA26133@ucbvax.Berkeley.EDU>
Date: 7 Jun 88 21:39:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 43

Date:  7-JUN-1988 14:39:15.48
From: PVR AT BGERUG51
To:   GATEWAY::"info-vax@kl.sri.com"
Subj: HELP ME: VAX VMS C fopen() problem with binary files
Dear mailing list,

If there is anyone out there who has conversion programs to convert files in
netdata format to ASCII ? If so, PLEASE let me know ! If anyone wants what I
have written till now, let me know that too.

When I wrote the netdata translation program, I ran into the following
problem of VAX VMS C:

#include stdio

main()
$
FILE *in;
int  ch;

  in = fopen("sd.nd","r");
  while ((ch = fgetc(in)) != EOF)
    printf("%02x  ", ch);


The simple (in Fortran we would say "unformatted") file "sd.nd" with netdata
data is read in char per char and written to stdout. There is a 0x0A (LF) added
after each record of 80 characters, although I don't want that. Is there any
way to say to VAX VMS C that I want a binary interpretation of the input file ?
In Turbo C (IBM) and Megamax (Atari) I use fopen(name, "rb") or ..."br"), but
what on the VAX ???

I found a way around it, but it is not very aesthetic.

Patrick Van Renterghem,                         Email: PVR@BGERUG51.BITNET
The Transputer Lab,                             Tel.:  +32 (91) 22 57 55
State University of Ghent.

=============================== cut here =====================================

Why isn't VMS as simple as UNIX ?

=============================== cut here =====================================