Introduction函数主要功能见函数名主要过程见注释void print_unknown_option(char const op) {std::string es;es = “Unknown option: “;es += op;es += “\n”;write(STDERR_FILENO, es.c_str(), es.size());}RequirementCSE 410 Fall 2018Computer Project #2Assignment OverviewThis assignment focuses on system-level programming in a Linux environment. You will design and implement theC/C++ program which is described below.It is worth 40 points (4% of course grade) and must be completed no later than 11:59 PM on Thursday, 9/20.Assignment DeliverablesThe deliverables for this assignment are the following files:proj02.makefile – the makefile which produces proj02proj02.student.c – the source code file for your solutionBe sure to use the specified file names and to submit your files for grading via the CSE handin system before theproject deadline.Assignment SpecificationsYour program will display the contents of each file whose name is listed by the user.1. The program will process each command line argument (from left to right) when the program is executed.a) If the argument is the name of a file, the program will display the contents of that file on the standard outputstream. The appearance of the output will be modified by any “+t” and “-t” options which have been previouslyprocessed.b) If the argument is the string “+t”, the program will display a title before each file is displayed. The title willconsist of three lines: a line containing a series of colons, a line containing the file name, and a line containing aseries of colons. The number of colons in the first and third lines will equal the number of characters in the filename. For example::::::::::::::::proj02.makefile:::::::::::::::c) If the argument is the string “-t”, the program will not display a title before each file is displayed. By default, theprogram will not display titles.d) If the argument is the string “-h”, the program will display a help message on the standard errorC++代写 Computer Project 2调试C/C++语言 stream.e) If the argument is an unrecognized option, the program will display an appropriate error message and a helpmessage on the standard error stream.f) If the argument is the name of a file which cannot be processed, the program will display an appropriate errormessage on the standard error stream.2. The program will use the following functions to perform. input and output operations on the input files andstandard streams:ssize_t read( int fd, void buf, size_t count );ssize_t write( int fd, const void buf, size_t count );The buffers associated with those functions will be 512 bytes in size.3. The program will use the following functions to manipulate the input files:int open( const char pathname, int flags );int close( int fd );The program will open the input files in “read-only” mode.4. The program will assume that the input files contain ASCII characters.5. The program will minimize the number of calls to function “write”.Assignment Notes1. As stated above, your source code file will be named “proj02.student.c”; that source code file may contain C orC++ statements.2. You must use “g++” to translate your source code file in the CSE Linux environment.3. As stated above, the command-line arguments will be processed from left to right. Therefore, the “+t” and “-t”options will only apply to file names which appear after a particular option. For example, consider the followingcommand line:proj02 fileA +t fileB fileC –t fileDThe “+t” option will be applied to “fileB” and “fileC”; the “-t” option will be applied to “fileD”.4. As stated above, the program will use “read” and “write” to perform. all input and output operations on theinput files and standard streams. However, you may use other library functions to manipulate the contents of thebuffers.For example, it might be helpful to use library functions which process strings (such as the functions declared in“string.h” or the C++ string class library).转自:http://ass.3daixie.com/2019030514860315.html
讲解:C++ Computer Project 2C/C++
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 本文转载自知乎 作者:季子乌 笔记版权归笔记作者所有 其中英文语句取自:英语流利说-懂你英语 ——————————...