004 vs中使用vc的函数

#define _CRT_SECURE_NO_WARNINGS
#include "stdafx.h"


int main()
{
    FILE *pFile = fopen("c:\\test.txt", "w");
    putc('x', pFile);
    fclose(pFile);

    return 0;
}
// vc : 打开文件函数 - fopen 
FILE *fopen( 
   const char *filename,
   const char *mode 
);


// vs : 打开文件函数 - fopen_s 
errno_t fopen_s( 
   FILE** pFile,
   const char *filename,
   const char *mode 
);


// 解决方法 - 添加预处理
#define _CRT_SECURE_NO_WARNINGS

猜你喜欢

转载自www.cnblogs.com/huafan/p/11484810.html
004