Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to get length of a file in c++

#include <iostream>
#include <fstream>

using namespace std;

int main()
{

  ifstream hin("<file_name>.txt");
  string cont[31];// There are 31 lines in this file

  for (int i = 0; i < 32; i++)
  {
    hin >> cont[i];
    cout << i<<" " << cont[i]<<endl;
  }


  return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #length #file
ADD COMMENT
Topic
Name
8+1 =