1
0
mirror of https://github.com/biergaizi/codecrypt synced 2024-06-30 02:43:06 +00:00
codecrypt/src/iohelpers.h

47 lines
1.4 KiB
C
Raw Normal View History

2013-04-20 07:49:20 +00:00
/*
* This file is part of Codecrypt.
*
* Codecrypt is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Codecrypt is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Codecrypt. If not, see <http://www.gnu.org/licenses/>.
*/
2013-04-20 21:08:09 +00:00
#ifndef _ccr_iohelpers_h_
#define _ccr_iohelpers_h_
2013-04-20 07:49:20 +00:00
/*
* output helpers
*/
#include <iostream>
2013-04-20 21:08:09 +00:00
#include <fstream>
#include <string>
2013-04-20 07:49:20 +00:00
#define out(x) std::cout << x << std::endl
2013-04-21 12:22:21 +00:00
#define out_bin(x) std::cout << x
2013-04-20 07:49:20 +00:00
#define outeol std::cout << std::endl
#define err(x) std::cerr << x << std::endl
#define erreol std::cerr << std::endl
2013-04-20 09:58:28 +00:00
#define progerr(x) std::cerr << argv[0] << ": " << x << std::endl
2013-04-21 10:47:20 +00:00
#define ask_for_yes(ok,x) do {std::cerr << x << " (y/n): "; \
2013-04-21 10:47:20 +00:00
std::string answer; std::cin >> answer; \
ok=(answer=="y");} while(0)
2013-04-20 21:08:09 +00:00
bool redirect_cin (const std::string& fn);
bool redirect_cout (const std::string& fn);
2013-04-20 07:49:20 +00:00
2013-04-22 10:30:21 +00:00
bool read_all_input (std::string&, std::istream&in = std::cin);
2013-04-21 12:22:21 +00:00
2013-04-20 07:49:20 +00:00
#endif