关于网友提出的“ 子函数调用oftream的问题”问题疑问,本网通过在网上对“ 子函数调用oftream的问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 子函数调用oftream的问题
描述:ofstream参数子函数
需要在子函数中实现数据输出
编译时出现错误:error C2061: 语法错误 : 标识符“ofstream”
// main函数
#include "stdafx.h"
#include
using namespace std;
ofstream be;
char fnbuf[256];
sprintf(fnbuf,"out.txt");
out.open(fnbuf);
myfunc(be);
// 子函数声明
void myfunc(ofstream s)
该怎么解决?
解决方案1:
// 声明
#include
void myfunc(std::ofstream *);
// 定义
#include
void myfunc(std::ofstream *s)
{}
以上介绍了“ 子函数调用oftream的问题”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3689945.html