[mod.computers.vax] problem with C fopen

MANSFIELD@DHDEMBL5.BITNET.UUCP (06/02/86)

The following program behaves curiously.
When you run it, the revision date of the file it opens
is updated, if that file is a stream_lf file.
If the file is variable length or fixed length, the
revision date is not updated.

This even occurs when the file protection is (s,o,g,w:r),
and the file is on a directory which is not mine.

Any explanations?

#include        <stdio.h>
main(argc, argv)
        int     argc;
        char    **argv;
        {
        FILE    *inf;
        char    line[BUFSIZ];

        argc--; argv++;
        if ( (inf = fopen(*argv, "r")) != NULL)
                puts("Opened");
        else
                puts("Can't open");
        }

LEICHTER-JERRY@YALE.ARPA.UUCP (06/05/86)

    The following program behaves curiously.  When you run it, the revision,
    date of the file it opens is updated, if that file is a stream_lf file.,
    If the file is variable length or fixed length, the revision date is not,
    updated.

    This even occurs when the file protection is (s,o,g,w:r), and the file is
    on a directory which is not mine.
    
    Any explanations?
    
    #include        <stdio.h>
    main(argc, argv)
            int     argc;
            char    **argv;
            {
            FILE    *inf;
            char    line[BUFSIZ];
    
            argc--; argv++;
            if ( (inf = fopen(*argv, "r")) != NULL)
                    puts("Opened");
            else
                    puts("Can't open");
            }
The VAX C RTL has to do some strange hacking to make stream files work right.
(Long story.  Basically, as far as RMS is concerned, stream files are just
as record oriented as other files, so you can't position to arbitrary bytes.
But C requires that you be able to do this.  So the C RTL ignores RMS and does
block I/O, which sometimes requires fixing up the file header - which is why
stream files don't work quite right over DECnet, and probably ultimately is
why this program acts as it does.)  Apparently there are some changes in VMS
V4.4, which has a new version of the C RTL - try it and see what happens.

							-- Jerry
-------

Joe@WASHINGTON.ARPA (Joe Kelsey) (06/07/86)

This problem with the C library was fixed in 4.4.  However, I seem to
be having problems with Unix filenames...I haven't explored the problem
very much yet.  I only verified that the library no longer "touches"
stream files opened for read access.

/Joe
-------