CSC415 Command Line Arguments

Posted 情旧余有温

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CSC415 Command Line Arguments相关的知识,希望对你有一定的参考价值。

CSC415-Assignment-1
Assignment 1 – Command Line Arguments Welcome to your First homework assignment.
Let me set some of the expectations. Code should be neat, well documented. Variables should have meaningful names and be in a consistent format (I do not care if you use camelCase or under_scores in variables but be consistent.
All filenames should be <lastname><firstname>_HW<#><optional>.<proper extension>, except Makefile.
In addition, each file should have a standard header as defined below. Make sure to put in your section number, your name, your student ID, a proper project name, GitHub name, filename, and description of the project.

  • Class: CSC-415-0# Summer 2021
  • Name:
  • Student ID:
  • GitHub Name:
  • Project: <project name>, Assignment 1 – Command Line Arguments
    *
  • File: <name of this file>
    *
  • Description:
    This is an INDIVIDUAL assignment. You can (and should) work in groups to research how to do the assignment, but each person should code their own version and make their own submission.
    This program is to demonstrate the usage of command line arguments in a C program. You will write this to run in the Linux virtual machine. The program should display the number of arguments from the command line and list each one on the console.
    Here is a sample execution:
    student:~/CSC415$ make run RUNOPTIONS="Hello, these are overridden options 3 6 9"
    gcc -c -o bierman_robert_hw1_main.o bierman_robert_hw1_main.c -g -I.
    gcc -o bierman_robert_hw1_main bierman_robert_hw1_main.o -g -I.
    ./bierman_robert_hw1_main Hello, these are overridden options 3 6 9

There were 9 arguments on the command line.
Argument 00: ./bierman_robert_hw1_main
Argument 01: Hello,
Argument 02: these
Argument 03: are
Argument 04: overridden
Argument 05: options
Argument 06: 3
Argument 07: 6
Argument 08: 9
student:~/CSC415$
You should submit your source code file(s), Makefile along with a short writeup in PDF format into your GIT repository and submit the PDF into the assignment in iLearn. Your write-up should include a description of the project and what you did, issues you had, how you overcame the issues and the compilation and execution output from your program (screen shots embedded in the PDF document. Your execution output should include commands with the command-line arguments.
All filenames should be <lastname><firstname>_HW<#><optional>.<proper extension>

File: Makefile

ROOTNAME=bierman_robert_HW
HW=1
FOPTION=_main
RUNOPTIONS=Hello World
CC=gcc
CFLAGS= -g -I.

To add libraries, add "-l <libname>", for multiple repeat prior for each lib.

LIBS =
DEPS =
OBJ = $(ROOTNAME)$(HW)$(FOPTION).o

%.o: %.c $(DEPS)

$(CC) -c -o $@ $< $(CFLAGS)

$(ROOTNAME)$(HW)$(FOPTION): $(OBJ)

$(CC) -o $@ $^ $(CFLAGS)  $(LIBS)

clean:

rm *.o $(ROOTNAME)$(HW)$(FOPTION)

run: $(ROOTNAME)$(HW)$(FOPTION)

./$(ROOTNAME)$(HW)$(FOPTION) $(RUNOPTIONS)

File: Makefile

ROOTNAME=bierman_robert_HW
HW=1
FOPTION=_main
RUNOPTIONS=Hello World
CC=gcc
CFLAGS= -g -I.

To add libraries, add "-l <libname>", for multiple repeat prior for each lib.

LIBS =
DEPS =
OBJ = $(ROOTNAME)$(HW)$(FOPTION).o

%.o: %.c $(DEPS)

$(CC) -c -o $@ $< $(CFLAGS)

$(ROOTNAME)$(HW)$(FOPTION): $(OBJ)

$(CC) -o $@ $^ $(CFLAGS)  $(LIBS)

clean:

rm *.o $(ROOTNAME)$(HW)$(FOPTION)

run: $(ROOTNAME)$(HW)$(FOPTION)

./$(ROOTNAME)$(HW)$(FOPTION) $(RUNOPTIONS)

WX:codehelp

以上是关于CSC415 Command Line Arguments的主要内容,如果未能解决你的问题,请参考以下文章

用于 Spring Boot 中测试的 Gradle 命令行参数

Command line is too long. Shorten the command line via JAR manifest

springboot项目运行错误:Error running ‘Application‘: Command line is too long.Shorten command line for

报错Command line is too long. Shorten the command line xxx解决办法

Error running ‘xxApplication‘: Command line is too long. Shorten command line for ......

Error running ‘xxApplication‘: Command line is too long. Shorten command line for ......