From 1b8b395003365ab25ee9549d2bd4629d0bd92fdb Mon Sep 17 00:00:00 2001 From: x-00010 Date: Fri, 23 Apr 2021 20:31:42 +0100 Subject: [PATCH] File read example --- cxor.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) mode change 100644 => 100755 cxor.cpp diff --git a/cxor.cpp b/cxor.cpp old mode 100644 new mode 100755 index e69de29..7bd0838 --- a/cxor.cpp +++ b/cxor.cpp @@ -0,0 +1,24 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + std::fstream fInput; + fInput.open(argv[1], std::ios::in); + if (!fInput) + { + std::cout << "File does not exist."; + } + else + { + char ch; + while (!fInput.eof()) + { + fInput >> ch; + std::cout << ch; + } + std::cout << std::endl; + fInput.close(); + } + return 0; +} \ No newline at end of file