Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If the compiler complains that /tmp is full (No space left on device), then set your TMPDIR environment variable to /scratch. You can do

 


If the compiler complains that /tmp is full ("No space left on device"), then set your TMPDIR environment variable to /scratch. You can do this in your bash shell and in your shell scripts like this TMPDIR=/scratch; export TMPDIR All editing must be done within the shell using a text editor. All work must be performed on cs l.utdallas.edu or cs2.utdallas.edu. No late homework is accepted. Example Output $> compile.sh Setting TEMPDIR environment variable to /scratch Compiling filel.cc Compiling filel2.cc Linking files to create executable hwl Done $> run.sh Running 'hwl' with 0 arguments: stdout appended to stdout.log stderr appended to stderr.log Running 'hwl' with 1 argument: stdout appended to stdout.log stderr appended to stderr.log Running 'hwl' with 5 arguments: stdout appended to stdout.log stderr appended to stderr.log Purpose Demonstrate the ability to use text editors in the shell. Demonstrate the ability to create and execute shell scripts. Demonstrate the ability to create and compile multi-file C+ programs. Demonstrate the ability to access the command line arguments from within a C+ program. Demonstrate proficiency in logging your console input/output using the script command. Assignment Log all the work you do in the bash shell using the script command (see the "Session Logging" section below). You will need to get logging working BEFORE you perform any of the steps listed below. You will need to turn in the session log files. See "Deliverables" below. With script logging on and working, write a program that consists of two C+ source files and a header file (.h file). The first C++ file contains the main() routine and the second file contains a C++ function. The function prototype should be included in the header file. From within main(), you must display the count of command line arguments to stdout. Further, you must display the value of each command line argument to stdout. Finally, you must call the procedure that is defined in the second file. From within the procedure defined in the second file, you must display a log message that states you are inside the procedure. This log message must be sent to stderr. You are then to create a shell script for compiling your code. The script will individually compile each file and generate the intermediate object file. Once the object files are created, the script will call the linker and link the object files into an executable. Your shell script should echo what it is doing at each step to stdout. $> more stdout.log argc was: 1 ./hwl Done! argc was: 2 ./hwl abc Done! argc was: 6 ./hwl a b Done! $> more stderr.log Inside procl () as stderr Inside procl () as stderr Inside procl () as stderr Session Logging Session logging will be performed using the Linux script command. For details, sce the man page for script (i.e. man script). Make sure that you are careful to NOT OVERWRITE any older script files you may have previously created. script will overwrite a file if you give it a file name that already exists. See the -a option to protect against this. You may exit the script program by typing: CTRL-D. You can either keep one long log file that spans multiple login sessions, or you can create multiple log files (or both). You are then to create a second shell script that will run your program several times with varying command line arguments. Each time you call your program, you should append the stdout to an output file called stdout.log and you should append the stderr to an output file called stderr.log. Your shell script should echo what it is doing at each step to stdout.

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Business Ethics Straight Talk about How to Do It Right

Authors: Linda klebe Trevino, Katherine A. Nelson

5th edition

047034394X, 978-0470343944

More Books

Students also viewed these Computer Engineering questions

Question

b. Where is it located (hospital, research institute, university)?

Answered: 1 week ago