Question: The following snippet of code is how the program is supposed to start, so please use it. This code takes care of bullet points 2,5,6,

 The following snippet of code is how the program is supposed

to start, so please use it. This code takes care of bullet

The following snippet of code is how the program is supposed to start, so please use it. This code takes care of bullet points 2,5,6, and the rest of the main function should be contained within the else statement at the bottom of the provided code. Please note bullet point 3. Also note that this is a C program and not a C++ program (had that mistake in the past). Many thanks!

#include

int

main(int argc, char *argv[]) { FILE *inp; // File pointer used to access the text file from within the program if(argc = 2) // The number of command-line arguments are greater or equal to 2 { // Attempt to open input file inp = fopen(argv[1], "r"); if (inp == NULL) /* The input file does not exist in the current * directory, or the filename is not exactly "testfile.txt" */ { // Displays error message about not being able to access the text file. printf("Could not open file. Program will terminate. "); exit(0); // Exits if statement after printing error message } else // Input file exists and is accessible { } } }

EE 233 Spring 2017 Program 6 Write a computer program as a Win32 console application in C to maintain a stack Abstract Data Type (ADT) of single characters. Use the basic ideas from Programming Project #3 in Chapter 13 (or Chapter 14 of the older book) of the course textbook. As in that problem, you must create header and implementation files ('stack.h" and "stack.c") for a data type stack t and operations on the stack. Use the functions push and pop as defined in the chapter The name of your source program shall be p6.c and that of your executable program shall be p6.exe You program shall receive information from the user as a command-line argument. For example, a typical command line to start your program (from a command prompt) might be L: p6 testfile2.txt. Your program shall NOT seek information from the user such as by a call to scanf() Your program shall NOT print information to the screen except as required herein. If your program is started without any command-line arguments, it shall print the following line to the screen and terminate execution: EE 233 Spring 2017 P6 kyour Blazer id your name (Fill in your real name in place of your name and be sure to follow the output with a newline If your program is started with at least one command-line argument, it shall NOT print the line given above but shall proceed with normal execution The first command-line argument (after the program name itself) will be the name of the text file for your program to read. The lines in this file may be of any ength. If the file supplied as a command-line argument cannot be opened, your program shall write an error message and terminate execution. In a similar manner, your program shall properly handle all error conditions that might arise Your program shall read the input text file and push each character onto the stack Abstract Data Type (ADT) Each character will be bounded by white space and all characters (letters, numbers, or punctuation, etc.) will be allowed for processing After your program has read and processed the entire file, it shall write all the characters down the screen in the order that they were popped from the stack har char (Fill in the real char value in place of and be sure to follow the output with a newline The completed program is due by 11:59 p.m. on Tuesday, April 18th, 2017

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!