How to use istrstream to read char array char by char in C++

1 Answer

0 votes
#include <iostream>
#include <strstream>  

using std::cout;
using std::endl;

int main()
{
	char s[] = "c c++ java php";

	std::istrstream iss(s);

	char ch;

	while (!iss.eof()) {
		iss.get(ch);
		if (!iss.eof()) cout << ch;
	}

	cout << endl;

	return 0;
}

/*
run:

c c++ java php

*/

 



answered Jun 17, 2018 by avibootz

Related questions

1 answer 433 views
1 answer 270 views
270 views asked Jun 6, 2018 by avibootz
1 answer 260 views
1 answer 200 views
200 views asked Feb 3, 2023 by avibootz
1 answer 264 views
1 answer 316 views
1 answer 276 views
276 views asked Jun 15, 2018 by avibootz
...