help with iofstream - Exception: STATUS_ACCESS_VIOLATION when writing or reading

Matias Bonaventura matiasb@gmail.com
Wed Jul 16 16:01:00 GMT 2008


Hi,

I´m trying to compile and run an application. It´s currently compiling
fine, but as soon as I run it I get the below error.
Debbugging the code I  manage to find it was failing when trying to
manipulate (read/write) a file.

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:
int main()
{
		cout << "[(!) DEBUG. Before opening the file]" << endl;
	    ofstream file;
	    file.open(FILE_NAME, ios::out);
	    if (file.is_open() && file.good() ){
		    cout << "[(!) DEBUG. Before writing into the file]" << endl;
		    file << "hola archivo";
		    cout << "[(!) DEBUG. After writeing into the file]" << endl;
		
		    file.close();
	    }
	
	    return 0;
}


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.

THANKS!


--
:-) M.A.T.I.A.S. :-)

--
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