Skip to content

Instantly share code, notes, and snippets.

@leandrobmarinho
Created March 6, 2019 21:29
Show Gist options
  • Save leandrobmarinho/4a6b99579a0ee992afa75f229883303f to your computer and use it in GitHub Desktop.
Save leandrobmarinho/4a6b99579a0ee992afa75f229883303f to your computer and use it in GitHub Desktop.
Here is a simple program in C++ to read a file using ifstream.
/*
Suppose the file has these values
inf1 inf2
*/
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ifstream infile("filename");
string first, second;
infile >> first >> second;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment