Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment will give you experience using structures, pointers, character strings, enumerated types, bitmap fields, and buffering data into blocks. The files assignment 2 .
This assignment will give you experience using structures, pointers, character strings, enumerated types, bitmap fields, and buffering data into blocks. The files assignmenth and assignmento are required for this assignment. The functions listed in assignmenth writePersonalInfo getNext, commitBlock, and checkIt have been written for you and are the functions in assignmento you do not have the source code that builds that object file Do not reimplement those functions.
There will be at least three arguments, but there may be more. Do not limit the number.
Step one read the assignment carefully and fully. Do each step and don't read more into it then is there.
Step two of this assignment is to review the provided header file assignmeth You will see a large number of #define statments the represent different computer lanaguages. Then there is a stucture called personalInfo. This is the structure you will allocate and populate. Next there is a #define of BLOCKSIZE set to this is going to be your buffer size to transform byte data into block data. Finally there are the prototypes for functions that you will need and are described in the steps below. Note that the functions are implemented in provided assignmento file, you do not implement them.
Step three is to remember some of the rules. Name your c file according to our standard of lastnamefirstnameHWmain.c edit the Makefile to enter your FIRST and LAST name this Makefile is a little different then the first one do not change anything other than the variables FIRSTNAME and LASTNAME Make sure to comment your code, have the standard header. Remember that for every malloc, there must also be a corresponding free. Use printf's to debug your program. In keeping code neat and readable, lines in your program including commments should be kept to about characters long but never more than characters.
Now what is the coding portion of this assignment...
Step four is to allocate using malloc an instantiation of the personInfo structure and to populate it The firstName and the lastName are populated from the st and second command line argument. You will then assign your student ID to the studentID field, you will populate the level gradelevel appropriately. You will then populate the languages field. To do so specify every language you have Knowledge of and there must be at least three by definition, with the prerequisites for the course you should at least know some Java, C some assembler and of course now C But, include all you have knowledge of The last part of populating the structure is to copy the third command line parameter to the message field. Do note the length of the message field.
Step five is to "write" your personal information structure by calling writePersonalInfo which is one of the function prototypes in the assignmenth file. The return value from the function is if it succeeds.
Step six involves getting a series of C stings you do not know how many or how long each one it or what it contains You get these strings by calling the function getNext. The return value is a char C string If the return value is NULL then you have finished. You will copy the contents of each of those strings into a buffer block that is BLOCKSIZE use malloc to allocate the buffer as the buffer is filled you will commit the buffer by calling commitBlock passing in the pointer to your BLOCKSIZE buffer. Note: You must copy the data into the buffer in chunks using memcpy not character by character
Step seven if the final coding step. Call the function checkIt, then exit main returning the same value as returned from checkIt.
Step eight is dependent on checkIt running correctly and displays some binary data as a hexdump which is the personalInfo structure. You are to describe what each element is use the structure as reference and show the values and how to read those values. ie which bytes are the student ID what is it's hexadecimal value and if that is converted to decimal is it correct? You are to prove that each value in the structure is correct and why it is correct. The purpose is so that you can be sure that what you thought should be written is actually written. Use color highlights and start and end addresses to describe each element from the hexdump output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started