There is a 1.txt file with text. How to copy from i to j from text to line and display? is there any analogy strncpy

  • What does "from i to j " mean? Are you about characters or strings? - VladD
  • @VladD symbol number - pmipmi

1 answer 1

 #include <iostream> #include <fstream> #include <string> using namespace std; void fncpy(int iMin, int iMax) { string strBuff; ifstream fin ("1.txt"); int i = 0; while (iMin > 0) { getline(fin, strBuff); iMin--; i++; } for(; i <= iMax; i++) { getline(fin, strBuff); cout << strBuff << endl; } fin.close(); } int main(void) { int iMinLine, iMaxLine; cin >> iMinLine >> iMaxLine; fncpy(iMinLine, iMaxLine); return 0; }