分页: 1 / 1

[问题]关于strstrea.h的问题

发表于 : 2008-05-16 11:02
hhts1987
#include<iostream>
#include<fstream>
#include<strstrea.h>
using namespace std;
int main()
{
char buf[80];
ostrstream out1(buf,sizeof(buf));
int m=25;
for(int i=0;i<6;i++)
{
out1<<"m="<<(m+=10)<<';';
}
out1<<'\0';
cout<<"buf:"<<buf<<endl;
double d=132.45678;
out1.setf(ios::fixed|ios::showpoint);
out1.seekp(0);
out1<<"The value of d is"<<d<<'\0';
cout<<buf<<endl;
char *pstr=out1.str();
cout<<pstr<<endl;
return 0;
}
结果是:
hala@hala-desktop:~/test$ g++ -o 11_29 11_29.cpp
11_29.cpp:3:21: 错误: strstrea.h:No such file or directory
11_29.cpp: In function ‘int main()’:
11_29.cpp:8: 错误: ‘ostrstream’ 在此作用域中尚未声明
11_29.cpp:8: 错误: expected `;' before ‘out1’
11_29.cpp:12: 错误: ‘out1’ 在此作用域中尚未声明
11_29.cpp:14: 错误: ‘out1’ 在此作用域中尚未声明
hala@hala-desktop:~/test$
请问那个strstrea.h头文件改成什么了
我自己摸索然后得出了结论
改用这个:
#include<strstream>
using namespace std;

发表于 : 2008-05-16 11:05
solcomo
strstream.h

发表于 : 2008-05-18 10:06
hhts1987
solcomo 写了:strstream.h
自己解决了,不是strstream.h
而是strstream
然后加个using namespace std;