[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3205.0. "ofstream open() fails to create file" by CADSYS::LANE () Fri Aug 16 1996 10:41

T.RTitleUserPersonal
Name
DateLines
3205.1interesting one!DECC::KIMMELFri Aug 16 1996 11:578
3205.2mode=ios::out, prot=filebuf::openprotCADSYS::LANEFri Aug 16 1996 16:4021
3205.3anything changing the location of the file?HNDYMN::MCCARTHYA Quinn Martin ProductionMon Aug 19 1996 10:038
3205.4is it already opened by someone else?HNDYMN::MCCARTHYA Quinn Martin ProductionMon Aug 19 1996 10:177
3205.5file doesn't exist before open() callCADSYS::LANEMon Aug 19 1996 11:4929
3205.6NQOS01::nqsrv427.nqo.dec.com::luskThree monkeys, ten minutesWed Sep 11 1996 12:522
3205.7deja vu, all over again...WRHS79::LANEThu Jan 16 1997 16:5765
3205.8TLE::D_SMITHDuane Smith -- DEC C RTLThu Jan 16 1997 20:4814
3205.9WRHS79::LANEFri Jan 17 1997 11:0935
3205.10start here....HNDYMN::MCCARTHYA Quinn Martin ProductionFri Jan 17 1997 11:149
3205.11problem still exists in DECC$SHR T06.2-05WRHS79::LANEFri Jan 17 1997 13:128
3205.12message to cerr never gets displayed...DECC::J_WARDFri Jan 17 1997 14:1319
3205.13cerrWRHS79::LANEFri Jan 17 1997 14:4920
3205.14Debugging this offlineTLE::D_SMITHDuane Smith -- DEC C RTLFri Jan 17 1997 17:192
3205.15mea culpaWRHS79::LANEFri Jan 24 1997 09:3727
    Well, I had something like this in my program that got executed at some
    point prior to calling ifstream::open():

        buffer = new char [strlen(value)];

        strcpy(buffer, value);

    It just so happened in this particular case that the null byte ended up
    clearing the "blockSize" field in the header of a memory block
    maintained by LIB$VM_MALLOC().
    
    When ifstream::open() got called, it in turn called the C RTL routine
    open().  In open(), the RMS blocks get allocated and initialized before
    SYS$OPEN() is called.  calloc() (which calls LIB$VM_CALLOC()) is called
    to allocate the RMS blocks.  When the NAM block got allocated,
    LIB$VM_MALLOC() returned the block with the incorrect zeroed block
    size, then LIB$VM_CALLOC() didn't clear anything because the block size
    was zero.  So, the NAM block fields had junk in them and this is what
    caused the RMS$_RLF error returned by SYS$OPEN().

    As usual, just when I begin to suspect the problem is in someone else's
    code, it winds up being my problem all along.

    Thanks to Duane for the help in setting up so I could find the cause of
    this bizarre problem.

    Roy