
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
I need help implementing this Add file i/o to my program
Any help and or assistance would be appreciated I've already tried a bunch of stuff but I am very confused
The code had too many characters so I have a link so that you fork it to continue to work on the code
https://onlinegdb.com/I_L8bKAlb

Transcribed Image Text:Add file i/o to your program
Implement a function writeEmpToFile that takes two arguments: a struct Employee pointer and a FILE *.
It should write each field in order as an appropriate type. Note that you will probably want to write a length of the name before you write the characters
of the name. By doing this, when you write the load function below, you can read the length of the string and use it to malloc a buffer of the proper size
to hold the name.
Because of the embedded name pointer, you CAN NOT write the Employee struct as a single struct. You will need to write it out field by field. You will
want to write this as a binary file, not as a text file.
Implement a SAVE command in your main loop that will save all the employees out to a file. The SAVE command should ask for a file name, similar to the
way your FIND command asked for a name.
Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer to a struct employee. This function should read the
information from the file (reversing what writeEmpToFile does), create a new employee and fill in the data. If the FILE has no more info (is at end of file),
this function should return NULL. This function must also ensure any employee actually created (not the NULL) is added to the array (as is done in
createEmployee).
Change main to load employees from a file if a command line argument is given to the program (using your readEmpFromFile function you just wrote).
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- The class I'm taking is assembly programming! I have attached the problem below! Please help! Thank you!arrow_forwardDashboard Courses Groups Calendar 凸 Inbox O History Studio (?) Help Resources Home Announcements Syllabus Modules Files Discussions Grades 3C Media Attendance Chat QUEST Online Readiness 34 Online Learning Student Technology. Help Desk NameCoach Question 15 What is it called when a variable is initialized before a loop to guarantee the loop is entered? O priming a loop counter control execution update Question 16 1 pts 1 pts When using a while loop, where is the update statement placed? (Use one-two words only and type in lowercase.)arrow_forwardThe class I'm taking is assembly programming. I am completely stuck. I have attached the problem. Please view attachment before answering. Thank you so much for your help! Any help is greatly appreciated.arrow_forward
- C PROGRAMMING ONLY PLEASE! NO IOSTREAM.H OR CACIO.H PLEASE! ATTACHED PNG IS THE QUESTION AND I HAVE THE REQUIRED TXT FILE PASTED BELOW, THANK YOU!: Distribution.txt: 0.5 0.50399 0.50798 0.51197 0.51595 0.51994 0.52392 0.5279 0.53188 0.535860.5398 0.5438 0.54776 0.55172 0.55567 0.55966 0.5636 0.56749 0.57142 0.575350.5793 0.58317 0.58706 0.59095 0.59483 0.59871 0.60257 0.60642 0.61026 0.614090.61791 0.62172 0.62552 0.6293 0.63307 0.63683 0.64058 0.64431 0.64803 0.651730.65542 0.6591 0.66276 0.6664 0.67003 0.67364 0.67724 0.68082 0.68439 0.687930.69146 0.69497 0.69847 0.70194 0.7054 0.70884 0.71226 0.71566 0.71904 0.72240.72575 0.72907 0.73237 0.73565 0.73891 0.74215 0.74537 0.74857 0.75175 0.75490.75804 0.76115 0.76424 0.7673 0.77035 0.77337 0.77637 0.77935 0.7823…arrow_forwardThe majority of source code is accessible in tarball format on the Internet. Is this statement true or false?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY