Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

C++ program to display the file by using command line of compiler

YASH PAL, 31 July 202418 February 2026

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

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
C++ Programming Tutorials coding problems solutions Programs

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes