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

 

posted @ 2019-09-08 11:12  火焰马  阅读(223)  评论(0编辑  收藏  举报