Please tell me how to read integer value from file using c++ classes.

It's easy! All you have to do is create an ifstream object and then use it just like you use cin:

#include <fstream>
#include <iostream>

int main()
{
  ifstream is("filename");
  int input;

  if (is >> input)
    std::cout << "Read " << input << '\n';
  else
    std::cout << "Couldn't read an integer\n";
}

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.