[Solved] COMP2560 Lab #2 System Call I/O

$25

File Name: COMP2560_Lab_#2__System_Call_I/O.zip
File Size: 301.44 KB

SKU: [Solved] COMP2560 Lab #2 – System Call I/O Category: Tag:
5/5 - (1 vote)

You can only use system call open/close/read/write/lseek. No library I/O allowed. You may be given different text files for lab test. Those texts may include linefeed, tab, space, integer, string etc.Part I.Write a C program called writer.c. It uses system call I/O to create a file calledlist1.txt which has the following text-based content:101 GM Buick 2010102 Ford Lincoln 2005There are three blanks between the first and the second columns. There is one tabbetween the second and third, and between the third and fourth columns.You can only call function write once. After file list1.txt is created, type the followingcommands to check the content of the file. Make sure you understand howcharacters are internally saved.>>>>> more list1.txt>>>>> od c list1.txt>>>>> od x list1.txtPart II.Write a C program called change1.c. Use system call I/O to open the file list1.txt, andreplace the string 101 with integer 101. After executing the program, type thefollowing commands to check the content of the file:>>>>> more list1.txt # doesnt work not text-based!>>>>> od c list1.txt>>>>> od x list1.txtPart IIIConsider the car list where the first and second columns are swapped, with a tabbetween them.GM 101 Buick 2010

Ford 102 Lincoln 2005Repeat Part I to create this text-based list2.txt. Use lseek() to write a program calledchange2.c. Similar to Part II, it works on list2.txt to replace the string 101 withinteger 101. Check your result.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP2560 Lab #2 System Call I/O
$25