![](/img/trans.png)
[英]#include excel error in C++ with Visual Studio 2015, Community edition
[英]header for fopen visual studio 2015 community edition
根據MSDN: https : //msdn.microsoft.com/zh-CN/library/yeby3zcb.aspx
對於“打開”,我需要包括必需的標頭: <stdio.h>
但是,我的以下代碼給出了錯誤:“ identifier fopen is notidentified”
#include "stdafx.h"
#include<cstdio>
#include<cstdlib>
int main()
{
char * buffer = NULL;
size_t size = 0;
FILE *fp = fopen("C:\Documents and Settings\psps.txt", "r");
return 0;
}
我應該包括什么以執行與文件相關的操作?
如您提到的,您可以嘗試包含<stdio.h>
。 或者,您可以在當前操作中包含<cstdio>
,然后改為使用std::fopen()
。
當C ++標頭將標准庫函數包裝在std
名稱空間中時。
另一個選擇是包括<fstream>
並學習C ++文件流類的方法(請參閱http://www.cplusplus.com/doc/tutorial/files/ )。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.