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 434 views
1 answer 279 views
279 views asked Jun 6, 2018 by avibootz
1 answer 265 views
1 answer 206 views
206 views asked Feb 3, 2023 by avibootz
1 answer 269 views
1 answer 325 views
1 answer 281 views
281 views asked Jun 15, 2018 by avibootz
...