1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <fcntl.h>
5
6 #include "student.h"
7
8 int main(int argc, char *argv[])
9 {
10 int fd, id;
11 char c;
12 struct student rec;
13 if (argc < 2) {
14 fprintf(stderr,"instruction : %s file\n", argv[0]);
15 exit(1);
16 }
17 if ((fd = open(argv[1],O_RDONLY)) == -1) {
18 perror(argv[1]);
19 exit(2);
20 }
21
22 do {
23 printf("\n do you want search a studebt id: ");
24 if (scanf("%d", &id) == 1) {
25 lseek(fd,(id-START_ID)*sizeof(rec), SEEK_SET);
26 if ((read(fd, (char *) &rec, sizeof(rec)) > 0 && (rec.id != 0))
27 printf("name:%s\t id:%d\t score:%d\n",rec.name, rec.id, rec.score); <---이부분이랑
28
29 else
30 printf("record %d not here\n",id);
31 } else printf("input error"); <--------- 이부분에서
32 printf("cotinue? (y/n)");
33 scanf(" %c", &c);
34 } while (c=='y');
35 close(fd);
36 exit(0);
37 }
오류가나는데요 우류내용
c:27:3 error: expected ')' before 'printf'
랑
c:31:2 error:expected expression before '}' token
이라고 나오는데 당최 모르겠어요.
~
~
괄호 각 잘 잡으라고
어디가 잘못된건데여.. 모르겠아요
26줄 끝에 ) 하나 붙이고 31줄에 } 지워
ㄳㄳ