#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <cstring>
#include <sstream>
#include <vector>
usingnamespace std;
using std::vector;
int main () {
string line, tmp;
vector <string> v;
ifstream myfile ("file.txt");
if (myfile.is_open())
{
while (! myfile.eof() )
{
v.push_back(line);
getline (myfile,line);
line += tmp;
line +="\n";
}
cout << v[142] << endl;
myfile.close();
}else
cout << "Unable to open file";
return 0;
}
Dear all currently my code only read by line.. I would like it to read line 142: [99] Hello // I want it to able to read the [99] part instead from line 142. How do I code it? Also it would be great if someone can teach me how to code from [99] to [126]. Thanks for helping me. Cheers!