My main.cpp
#include <iostream>
#include <fstream>
int main(int argc, char* argv[]) {
std::string filename;
std::cin >> filename;
std::ifstream inf(filename);
std::string line;
while(std::getline(inf, line)) {
std::cout << line << std::endl;
}
return 0;
}
Trying to read:
main < somefile.txt
I was old that when you write, <
or >
it's a directive for stdout
/stdin
(cin
/cout
). I want to read line by line, and check for EOF, in C++.
EDIT: Nothing really happens. Are there any C++ 20 recommendations for faster C++, I know C is normally faster.
file.txt:
300 55 12
56 99 -21