讲解:C++ Computer Project 2C/C++

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,727评论 0 3
  • 本文转载自知乎 作者:季子乌 笔记版权归笔记作者所有 其中英文语句取自:英语流利说-懂你英语 ——————————...
    Danny_Edward阅读 43,953评论 4 38
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,936评论 0 0
  • 同路人 话说2017年2月24日星期五,我们官兵一行四人轻装简行,前往京城取经。唐僧级别的领导自然是我们的校长姐姐...
    杨爱民阅读 486评论 0 2
  • 根据上周文章中的woop模型所制定的计划,来说说上周备考的总体情况,主要从克服困难及计划执行情况说: 一.克服困难...
    zxiong_2005阅读 239评论 0 0