#include<fstream>
#include<vector>
using namespace std;
int main()
{
ifstream file;
string inputString;
vector<string> data;
file.open("/path/to/file");
while(file>>inputString) //reads one string at a time
data.push_back(inputString); //add it to data vector
file.close();
}
Code Example |
---|
Cpp :: c++ index of nth occurence |
Cpp :: check file exist cpp |
Cpp :: c++ for loop |
Cpp :: c++ writing to file |
Cpp :: c++ save typeid |
Cpp :: pairs |
Cpp :: xmake run with arg |
Cpp :: cout hex value |
Cpp :: assign a struct to another c++ |
Cpp :: how to speed up cin and cout |
Cpp :: add on screen debug message ue4 |
Cpp :: random in range c++ |
Cpp :: qstring get if empty |
Cpp :: xmake set binary name |
Cpp :: n queens c++ |
Cpp :: c++ get last character of string |
Cpp :: is C++ useful in 2021 |
Cpp :: Array sum in c++ stl |
Cpp :: cpp goiver all the map values |
Cpp :: map defualt value c++ |
Cpp :: c++ initialize array with all zeros |
Cpp :: c++ lock |
Cpp :: how to use string variable in switch case in c++ |
Cpp :: queue in c++ |
Cpp :: c++ open all files in directory |
Cpp :: take pieces of a string in c++ |
Cpp :: for in c++ |
Cpp :: c++ add object to array |
Cpp :: c++ random number between 0 and 1 |
Cpp :: decltype in c++ |