Question: C + + comand line help I have the code shown below. I am not able to run it from the command line. Is there
C comand line help I have the code shown below. I am not able to run it from the command line. Is there something I am missing?
code:
#include
#include For file handling
using namespace std;
int mainint argc, char argv
Check if there are at least arguments
if argc
Open a file named "output.txt for writing
ofstream outputFileoutputtxt;
Check if the file is successfully opened
if outputFileisopen
Write the first commandline argument to the file
outputFile "your word was argv;
outputFile.close;
cout "File created successfully!" endl;
else
cout "Unable to create file!" endl;
else
cout "Usage: argv endl;
return ;
cmd in image
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
