Alex Rivera | Logout

fopen deprecated warning

Asked 2008-08-18T09:38:58.913
74

With the Visual Studio 2005 C++ compiler, I get the following warning when my code uses the fopen() and such calls:

1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated
1>        c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
1>        Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'

How do I prevent this?

Edit
Report

1 Answer

4

Consider using a portability library like glib or the apache portable runtime. These usually provide safe, portable alternatives to calls like these. It's a good thing too, because these insecure calls are deprecated in most modern environments.

answered 2008-09-18T11:15:58.880

Your Answer