注册 登录
编程论坛 C++教室

关于fstream文件流

八半个桑 发布于 2016-05-20 18:16, 3278 次点击
程序代码:
#include<iostream>
#include<fstream>
#include<iomanip.h>
using namespace std;
void main()
{
    ofstream f1("c:\\成绩单.txt");    //文件已创建      
  if(!f1)return;                 
  f1<<setw(20)<<"姓名:"<<"小明"<<endl;     
  f1<<setw(20)<<"家庭地址:"<<"asd"<<endl;
  f1.close();   

}


错误信息:
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class __SMANIP_int' (or there is no acceptable conversion)

请问这个错误信息是什么 错哪里了?
2 回复
#2
rjsp2016-05-20 19:22
#include<iomanip.h>
C++中出现.h头,你不觉得奇怪吗?
#3
八半个桑2016-05-20 22:24
回复 2楼 rjsp
哦哦  谢了   小细节给忽视了  
1