1 / 3

시스템 호출

시스템 호출. read , write 의 효율성 lseek test off_t lseek(int filedes, off_t offset, int start_flag); SEEK_SET SEEK_CUR SEEK_END filedes = open(filename, O_RDWR); lseek(filedes, (off_t)0, SEEK_END); write(filedes, outbuf, OBSIZE);

Télécharger la présentation

시스템 호출

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 시스템 호출 • read , write의 효율성 • lseek test • off_t lseek(int filedes, off_t offset, int start_flag); • SEEK_SET • SEEK_CUR • SEEK_END filedes = open(filename, O_RDWR); lseek(filedes, (off_t)0, SEEK_END); write(filedes, outbuf, OBSIZE); => open(filename, O_RDWR|O_APPEND); write(filedes, outbuf, OBSIZE); • example – test1.c • 실습 – 연습문제 2.8

  2. 시스템 호출 • P34 – 호텔 예 • createdata.c • getoccupier.c, test3.c • gcc –o test3 test3.c getoccupier.c • (실습) • 방 번호는 argc, argv를 사용해서 command로 부터 입력 받음 --- atoi(argv[1]) 사용 • 해당 방 번호의 투숙객을 출력 • 연습문제 2.10 • 방 번호는 argc, argv를 사용해서 command로 부터 입력 받음 --- atoi(argv[1]) 사용 • 한 방으로부터 투숙객을 제거하는 freeroom 루틴을 작성 • 방이 비어 있는지를 조사한 후, 새 손님을 방에 넣는 addguest를 작성

  3. 시스템 호출 • 파일의 끝에 자료 추가 – p37 • 파일의 제거 – test5.c • fcntl • F_SETFL, F_GETFL • 읽기 전용으로 개방된 파일을 읽기 쓰기용으로 개방된 파일로 변경 불가능 • test6.c

More Related