I am currently working on a text editor and i only want to display one line/row at a time, not the whole file. I als want to skip forwards and backness through from line to line in a textfile. Can someone please help me
I would just read the entire file line by line into a vector. Do your editing/displaying using the vector (or other container). When finished, save the contents of the vector to the file.
I am trying to write a text editor with the capability to read a File Line by line. My aim is to read the file into a vector and then later in the Program i want to go up and down in the File, by reading just one line, the current one in the Vector.
I am currently new to C++ and I have been struggling quite a while with this task, would appreciate any form of help
quelldatei.open(datei_name, ios:: in); // Datei wird zum zum lesen geö
if (!quelldatei)
{
cerr << "Die Datei konnte nicht geöffnet werden!"; // Fehler Kontrolle
return (2);
}
zeilen_vektor.clear(); //Vector wird gelöscht
istream_iterator<string> begin(quelldatei); // Afng Iterator auf Datei
istream_iterator<string> end; // Ende des Iterators
copy(begin, end, back_inserter(zeilen_vektor)); // Datei erneut auslesen
Thank you, was very helpful! Is there a reason why some programmers type "std::" in front of every instruction and some just write "using namespace std" ?