In this post, we will write a C++ program to display the file using the compiler command line.
C++ program to display the file by using command line of complier.
#include<iostream>
#include<conio.h>
#include<process.h>
#include<fstream>
using namespace std;
int main(int a, char *b[])
{
system("cls");
char ch;
ifstream add(b[1]);
if(!add)
{
std::cout<<"File opening error"<<std::endl;
getch();
exit(0);
}
if(a != 2)
{
std::cout<<"Syntax error"<<std::endl;
getch();
exit(0);
}
while(add)
{
add.get(ch);
std::cout<<ch;
}
getch();
return 0;
}
Output
If you think education is expensive then try ignorance Migh is Sight