Ceng 351 Lab1
Download
Report
Transcript Ceng 351 Lab1
Ceng 351 Lab2
Appending to A File
• To continue on a pre-created file, it is required
to open a file with a(append) mode
– fopen(“filename","a");
– Code Lab2_1.cpp
File Operations
• Lab2_2.cpp
Surfing in Files
• fseek
fseek(infile,0, 0); // moves to the
beginning
fseek(infile, 0, 2); // moves to
the end
fseek(infile,-10, 1); //moves 10
bytes from
//current
position
Surfing in Files
• fseek, for our personnel file
fseek(fp,(k-1) *sizeof(pers),
seekset); //to reach kth record
• fseek only useful in binary files so create your
files as binary files look at Lab2_3.cpp
Update in a File
• Lab2_4.cpp
Lab Homework
• Programming exercise;
– As addition to your car information, add another field as price and give initial
price to the each car. (Do not forget you have to add at least 10 cars)
– Calculate number of cars for each model(like there are 15 fiat)
– Calculate the average and total price.
– Now add each car 20% VAT and calculate before tax and after tax values.
– Calculate average and total price .
• Do not forget, every result have to be written into the file in a proper format.
• Studying exercise;
– Prepare a report that compares design of Solid State Disk, and Hard Disk
Drives. Draw their disk structures design specs like in the lecture notes. Explain
that according to tracks, cylinder, heads and arm, sectors, inter-sector gaps,
interleaving, disk controller.
– Compare different RAID standards with each other and explain how they
work on HDD systems with a drawing.
Send your lab homework Lab2_StudentID_Name_Surname.zip
Lab Homework
• No LAB NEXT WEEK
• Due Date:
– For Section 1, October 24, Monday 12 PM
– For Section 2, October 25, Tuesday 12 PM
– For Section 3, October 26, Wednesday 12 PM