I have a vector which holds the contents of a text file and I want to display the vector in a ncurses view, so the user can scroll through the contents. It's for a text editor/viewer.
My current code to view files:
1 2 3 4 5 6 7 8
i = 1;
for (std::vector<string>::const_iterator i = bank.begin(); i != bank.end(); ++i) {
std::cout << *i;
std::cout << endl;
}
i =1;
Later I'd like to be able to edit parts with a gap buffer, but I don't know how to realize this.
Thank you, Ihatov!
I think there's a problem because I'm reading a file into one big vector string instead of a list of vector strings. Don't know whether this is the right definition for it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
ifstream input_file(temp);
if (input_file.is_open())
{
std::string s((std::istreambuf_iterator<char>(input_file)), std::istreambuf_iterator<char>());
(void)bank.insert(bank.end(),s);
input_file.close();
temp = "end";
aw = 1;
ClearScreen();
} else cout << "Can't open this. Try again or type 'end'." << endl;
What shall I do? I think this will also help me to create my gap buffer.