Compare commits
7 Commits
b2ff9ec1e2
...
ab9757f672
Author | SHA1 | Date |
---|---|---|
latenightz | ab9757f672 | |
latenightz | d4dfcdfdc9 | |
latenightz | 3a2c38a8cb | |
latenightz | 6e7fd053ff | |
latenightz | 7c887e662c | |
latenightz | 24fbe6feb6 | |
latenightz | a7cb3d73bd |
|
@ -2,4 +2,6 @@
|
|||
|
||||
C++ library for making your programs easier. (sometimes)
|
||||
|
||||
<a href="https://tildegit.org/latenightz/ezlib/wiki">The wiki can be found here</a>, it includes tutorials for using EZLib!
|
||||
<a href="https://tildegit.org/latenightz/ezlib/wiki">The wiki can be found here</a>, it includes tutorials for using EZLib!
|
||||
|
||||
pre-releases can be found on the `pre-release` branch.
|
|
@ -0,0 +1 @@
|
|||
btest
|
33
lib/ez.h
33
lib/ez.h
|
@ -1,10 +1,11 @@
|
|||
// Includes basic EZLib functions
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
|
||||
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,11 +13,15 @@ void ezl_hello(int nl) {
|
|||
}
|
||||
}
|
||||
|
||||
void ezl_ver(int nl) {
|
||||
cout << "This feature is not yet availible in EZLib. int nl:" << nl;
|
||||
void ezl_info() { // Info about EZLib
|
||||
cout << "EZLib v1.0.0"; // NL is disabled by default
|
||||
}
|
||||
|
||||
void ezl_time(int nl) {
|
||||
void ezl_ver(int nl) { // Redirected to ezl_info()
|
||||
ezl_info();
|
||||
}
|
||||
|
||||
void ezl_time(int nl) { // Prints the UNIX Timestamp
|
||||
const auto p1 = std::chrono::system_clock::now();
|
||||
if (nl == 1) {
|
||||
cout << chrono::duration_cast<std::chrono::seconds>(
|
||||
|
@ -27,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();
|
||||
}
|
|
@ -14,4 +14,6 @@ int main() {
|
|||
ezl_time(1); // Displays system time using EZLib
|
||||
// Note: if 1 is added in the parenthesis, it will print a newline \n at the end.
|
||||
// Using 0 or any integer but 1 will result in no newline.
|
||||
ezl_wf("testing.txt", "hello, this was written with ezlib's file writer.\n"); // write to "testing.txt"
|
||||
ezl_rf("testing.txt"); // Reads the file "testing.txt"
|
||||
}
|
Loading…
Reference in New Issue