[ create a new paste ] login | about

Link: http://codepad.org/RiZGo3ia    [ raw code | output | fork ]

C++, pasted on Jun 22:
#include <fstream>
#include <iostream>
#include <ostream>
#include <string>

int main()
{

	std::ifstream stream("/");

	if(
		!stream.is_open()
	)
	{
		std::cerr << "not open\n";

		return 0;
	}

	std::string line;

	while(
		std::getline(
			stream,
			line
		)
	)
		std::cout << line << '\n';

	if(
		stream.bad()
	)
		std::cout << "stream is bad\n";

	if(
		stream.fail()
	)
		std::cout << "stream failed\n";
	
	if(
		stream.eof()
	)
		std::cout << "stream at eof\n";
}


Output:
1
not open


Create a new paste based on this one


Comments: