Question
In c++, This program takes zero or one command line argument only so, a file is being read using fstream If zero command line arguments
In c++, This program takes zero or one command line argument only so,
a file is being read using fstream
If zero command line arguments are specified, the program should take input from the standard input and print "no command line arguments so, we are taking from standard input"
If one command line argument is specified, the program should use the argument as a file name and take input from that file and print " we are reading from a file that is in the command line"
If the file cannot be opened, the program should print "COULD NOT OPEN", and should then stop.
also when you check the file, check if it is empty, if the file is empty print "file is empty"
If more than one command line argument is specified, the program should print TOO MANY FILENAMES, and should then stop.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started