字符串流 ostrstream 和 istrstream

 

 

ostrstream类流
/*ostrstream流可以实现将一个二进制数转换成串的字符存入在字符数组对象中。*/
#include
#include
#include
void main()
{
	const int LENGTH=80;
	char buffer[LENGTH];
	double dnum=-1234.512356;
	ostrstream sout(buffer,sizeof(buffer));
	sout.setf(ios::fixed|ios::showpoint|ios::showpos);
	sout<
#include
void main()
{
	const int LENGTH=80;
	char buffer[LENGTH]="65 43.21";
	char buffer2[LENGTH]="543.21";
	double d;
	int i;
	istrstream sin(buffer);
	sin>>i>>d;
	cout<>d;
	cout<
 

你可能感兴趣的:(C/C++)