Block-Oriented Binary File I/O

 

Given a table Student(char name[20], unsigned ID, float score, int age),

Write a program in C/C++ for the following requirements.

 

1.    Read a text file in_student.txt where the format is as following;

 

N // number of student records

Julius Cesare, 201512345, 3.6, 28

¡¦

Immanuel Kant, 190234952, 2.4, 45

 

2.    Store it to a binary file out_student.dat

-       A record must not be stored in two blocks. Instead, leave gab after the final record of each block as the figure below

 

 

image001.png

-       Size of block is 4096 bytes.

 

3.    Given an ID, search the student with this ID, print the name of the student, and the block number containing this student record.

 

Submission: submission site will be announced.

Due: April 24, 2018

Oral Test: ½Ã°ø°£µ¥ÀÌÅͺ£À̽º¿¬±¸½Ç (ÀÚ¿¬´ë¿¬±¸½ÇÇ赿 422È£)

Sample data

# 4/18 updated : sample data is uploaded. Oral Test date is postponed to 4/24.

# 4/23 : Check your oral test time and please contact us if there is a problem. ÀÚ½ÅÀÇ °Ë»ç½Ã°£ Ç¥ È®ÀÎ ÈÄ ¹®Á¦ ÀÖÀ¸¸é Á¶±³¿¡°Ô ¿¬¶ôÁÖ¼¼¿ä.

Çйø

À̸§

10:00

201424426

±èÀ±¼ö

201424479

½Å¿ìÂù

10:40

201424409

±è°æ¹Î

201324538

ÃÖ¿µ¿ø

11:00

201324516

Á¤¼ö¹Î

11:20

201624449

±èÀ±Á¤

12:00

201424437

±èÁøȸ

201424452

¹Ú±âÅÂ

201424474

¼Õ¼öÈ£

201424470

¼­¹Î¿µ

201424527

Á¤¼º¿À

13:40

201424419

±è¼¼Àº

201424410

±è±ÔÅÂ

201324436

±èÇÐÇö

14:00

201524653

Ȳ¼±Áø

201524551

ÀÌÇÏ¿ø

201324444

¹Ú¹Îö

14:20

201524452

·ù°­Çö

201324476

¾ÈÇö¸ð

201624408

±Ç¹Î¼±

17:00

201424454

¹Ú´Ù¿Â

201424438

±èâ¼·

17:20

201424415

±è¹ÎÁØ

201624503

½ÅÀÎö

201524626

»þÆ÷·Îºê ¹ÌÇÏÀÏ

201724565

Àü¼³

19:00

201424402

±¸¹Î±Ô

201424513

ÀÌÅ¿À

201324416

±èµ¿È¯

201545832

ÀÌÁöÈ£

201424540

Á¶¹ÎÁ¤

19:20

201424469

¼­±¤Çö

201424405

±Ç¿µºó

201424517

ÀÓµµ°æ

19:40

201424485

½É¿¹¿ø

201624450

±èÀçÀÎ

201424496

¿À¼¼Çö

20:00

201424483

½ÅÇѱÔ

201624510

¾È¼Ò¿¬

201424440

±èÆÇÁØ

20:20

201424530

Á¤¿ø¿í

201424532

Á¤À籤

20:40

201524629

Assem Utaliyeva

201624585

Á¦°¥Âù

201424468

¼­°ÇÀ±

21:00

201424510

ÀÌÀº±Ô

201424471

¼­Áö¿ø

21:20

201624601

ÃÖ¼öȯ

21:40

201524647

ÀÌ¿øÁØ

201324483

À¯Çϸ°