Link to home
Start Free TrialLog in
Avatar of Samer Kharsa
Samer Kharsa

asked on

type any file contents using simple C++ program

My problem is that the program I wrote in C++ is not displaying what it should show. All I want it to do is to accept any path & filename & display its contents. My program is the following:

#include<iostream.h>
#include <fstream.h>
#include <iomanip.h>
main(char *path)
{
      ifstream textfile(path, ios::in);
      while (!textfile.eof()){
            char ch;
            textfile.get(ch);
            cout << ch;
      }
      textfile.close();
      return 0;
}
ASKER CERTIFIED SOLUTION
Avatar of tomkeane
tomkeane

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial