help with iofstream - Exception: STATUS_ACCESS_VIOLATION when writing or reading

Dave Korn dave.korn@artimi.com
Wed Jul 16 16:40:00 GMT 2008


Matias Bonaventura wrote on 16 July 2008 17:01:

> I reduce the error and create a simple test case which outputs the same
> error: 
> 
> 
> 
> [(!) DEBUG. Before opening the file]
> [(!) DEBUG.  Before writing into the file]
> 57 [main] test 5664 _cygtls::handle_exceptions: Exception:
> STATUS_ACCESS_VIOLATION
> 766 [main] test 5664 open_stackdumpfile: Dumping stack trace to
> test.exe.stackdump
> 
> 
> The test case code I´m using:

  No it isn't.

  When I tried to compile the code you gave I get all these errors:

./fileio.cc: In function `int main()':
./fileio.cc:6: error: `cout' undeclared (first use this function)
./fileio.cc:6: error: (Each undeclared identifier is reported only once for
each function it appears in.)
./fileio.cc:6: error: `endl' undeclared (first use this function)
./fileio.cc:7: error: `ofstream' undeclared (first use this function)
./fileio.cc:7: error: expected `;' before "file"
./fileio.cc:8: error: `file' undeclared (first use this function)
./fileio.cc:8: error: `FILE_NAME' undeclared (first use this function)
./fileio.cc:8: error: `ios' has not been declared
./fileio.cc:8: error: `out' undeclared (first use this function)

... and the moral of the story is "If you want people to help you with a
problem, don't tell them lies".  Show them the REAL code, not a useless
snippet that won't compile.

> Any idea why this could be happening? Is it a problem with my cygwin
> instalation, with the compiler....?
> 
> I´m using gcc-2.95. I didn´t try with newer versions because the
> application I´m trying to compile targets that compiler and won´t work
> the newer.

  There are known to be bugs in 2.95 and in particular in 2.95's version of
the C++ runtime and STL.

  I nearly didn't bother, because I had to go look up which headers to
include and fix your non-compiling code, but I was feeling generous, so I
fixed it and built it with current gcc-3.3.3; it works fine with that.

>I didn´t try with newer versions because the
> application I´m trying to compile targets that compiler and won´t work
> the newer.

  Well, you need to have a serious think about that, because your
application clearly won't work with that older one either.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list