首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

子函数调用oftream的有关问题

2013-09-06 
子函数调用oftream的问题需要在子函数中实现数据输出编译时出现错误:error C2061: 语法错误 : 标识符“ofst

子函数调用oftream的问题
需要在子函数中实现数据输出
编译时出现错误:error C2061: 语法错误 : 标识符“ofstream”


// main函数
#include "stdafx.h"
#include <fstream>
using namespace std;

ofstream be;
char fnbuf[256];
sprintf(fnbuf,"out.txt");
out.open(fnbuf);
myfunc(be);

// 子函数声明
void myfunc(ofstream s)


该怎么解决? ofstream 参数 子函数
[解决办法]
引用:
但这时它会出现函数重载的错误,编译还是error C2061:语法错误 : 标识符“ofstream”



// 声明
#include <fstream>
void myfunc(std::ofstream *);
// 定义
#include <fstream>
void myfunc(std::ofstream *s)
{}

热点排行