Skip to content

Instantly share code, notes, and snippets.

@foxoman
Last active August 29, 2015 14:02
Show Gist options
  • Save foxoman/a46f082b18773aa6bec2 to your computer and use it in GitHub Desktop.
Save foxoman/a46f082b18773aa6bec2 to your computer and use it in GitHub Desktop.
OPENING FILE USING CONSTRUCTOR in C++
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
string myDBString;
ifstream myDB("DB.text");
getline(myDB,myDBString); //read the first line
cout << myDBString << endl;
myDB.close ();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment