From d4dfcdfdc96d304f0ae2c25ac04364ece3483cc2 Mon Sep 17 00:00:00 2001 From: latenightz Date: Mon, 26 Apr 2021 19:24:25 +0000 Subject: [PATCH] Update 'lib/ez.h' --- lib/ez.h | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/ez.h b/lib/ez.h index 16d3e8d..c3cac9c 100644 --- a/lib/ez.h +++ b/lib/ez.h @@ -1,10 +1,11 @@ // Includes basic EZLib functions #include #include +#include using namespace std; -void ezl_hello(int nl) { +void ezl_hello(int nl) { // Print a hello message if (nl == 1) { cout << "Hello, from EZLib!\n"; } else { @@ -12,15 +13,15 @@ void ezl_hello(int nl) { } } -void ezl_info() { +void ezl_info() { // Info about EZLib cout << "EZLib v1.0.0"; // NL is disabled by default } -void ezl_ver(int nl) { +void ezl_ver(int nl) { // Redirected to ezl_info() ezl_info(); } -void ezl_time(int nl) { +void ezl_time(int nl) { // Prints the UNIX Timestamp const auto p1 = std::chrono::system_clock::now(); if (nl == 1) { cout << chrono::duration_cast( @@ -31,3 +32,23 @@ void ezl_time(int nl) { } } + +void ezl_rf(string filename) { // Reads a file + string ezlrf_output; + ifstream ezl_readfile(filename); + + while (getline (ezl_readfile, ezlrf_output)) { + cout << ezlrf_output; +} + + ezl_readfile.close(); + +} + +void ezl_wf(string filename, string text2write) { // Writes a file + ofstream ezl_writefile(filename); + + ezl_writefile << text2write; + + ezl_writefile.close(); +} \ No newline at end of file