Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
In general, coreutils are compiled for windows, so you can look at the original code .
But in general, there is nothing complicated in implementing such behavior. In the simplest case, you can do this:
#include <fstream>
#include <iostream>
#include <string>
int main()
{
std::ifstream s("test");
while (true) {
if (!s.eof()) {
std::string line;
if (std::getline(s, line)) {
std::cout << line << '\n';
}
}
else {
s.clear();
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question