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 347 views
1 answer 184 views
184 views asked Jun 6, 2018 by avibootz
1 answer 193 views
1 answer 117 views
117 views asked Feb 3, 2023 by avibootz
1 answer 225 views
1 answer 176 views
1 answer 199 views
199 views asked Jun 15, 2018 by avibootz
...