File read example

This commit is contained in:
x-00010 2021-04-23 20:31:42 +01:00
parent b19d9a2962
commit 1b8b395003
1 changed files with 24 additions and 0 deletions

24
cxor.cpp Normal file → Executable file
View File

@ -0,0 +1,24 @@
#include <iostream>
#include <fstream>
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;
}