Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

stock a file in a vector cpp

#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(); 
}
 
PREVIOUS NEXT
Tagged: #stock #file #vector #cpp
ADD COMMENT
Topic
Name
6+8 =