Click here to Skip to main content
15,896,606 members
Articles / Programming Languages / C++

how i use the new function fopen_s in Visual C++

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
29 Dec 2012CPOL 60.5K   1  
Hy,please help me with the following program written in C which seems to not work in Visual C++.#include "stdafx.h"#include "string.h"# include "process.h"# include "malloc.h"#define maxim 20int _tmain(int argc, _TCHAR* argv[]){ FILE *fis; int v=20; float...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
29 Dec 2012Richard MacCutchan
First thing to do in all cases is check the documentation[^]. As you can see, the first parameter should be a pointer to a FILE* variable, so the line in your code should read:errno_t errorCode = fopen_s(&fis, "C:\\test", "w");Note that the function returns an error code rather than a...
Please Sign up or sign in to vote.
29 Dec 2012Thomas Daniels
Hi,Change this:#include "stdafx.h"#include "string.h"# include "process.h"# include "malloc.h"Into this:#include "stdafx.h"#include "malloc.h"#include #include #include [EDIT]I see in your code that you use some quotation...
Please Sign up or sign in to vote.
5 Jan 2013MariusBV
#include "stdafx.h"#include "malloc.h"#include #include #include #define maxim 20 int _tmain(int argc, _TCHAR* argv[]){ FILE *fis; int v=20; int i=17; char name[maxim]; char...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions