I need to get very basic input from an external file in C++. I tried searching the internet a few times but nothing really applied to what I need. This would be a .txt file that
You can open a file for input with std::ifstream from the header , then read from it as you would from std::cin.
std::ifstream
std::cin
int main() { std::ifstream input("somefile.txt"); int a; input >> a; // reads a number from somefile.txt }
Obviously, you can use >> in a loop to read multiple numbers.
>>