PowerPoint 프레젠테이션

Size: px
Start display at page:

Download "PowerPoint 프레젠테이션"

Transcription

1 File System Jo, Heeseung

2 유닉스파일의특징 [1] 파일 유닉스에서파일은데이터저장, 장치구동, 프로세스간통신등에사용 일반파일, 디렉토리, 특수파일 일반파일 텍스트파일, 실행파일, 라이브러리, 이미지등유닉스에서사용하는대부분의파일 디렉토리 디렉토리도파일로취급 디렉토리에속한파일의목록과 inode 를가진파일 특수파일 - 장치파일 장치를파일로표현 예 : /dev/sda1 2

3 유닉스파일의특징 [1] 3

4 유닉스파일의특징 [2] 파일의종류구분 ls l 명령으로파일의종류확인 - 결과의맨앞글자로구분 # ls -l /usr/bin/vi -r-xr-xr-x 5 root bin 월 14 일 /usr/bin/vi 파일종류식별문자 4

5 유닉스파일의특징 [3] 파일의구성요소 파일명 inode 파일명, inode, 데이터블록 사용자가파일에접근할때사용 파일명과관련된 inode 가반드시존재 최대 255 자까지가능 대소문자를구분 '.' 으로시작하면숨김파일 번호로표시 두부분으로나누어정보저장 - 파일정보를저장하는부분 ( 메타데이터 ) - 데이터블록의주소저장하는부분 ls i 명령으로 inode 번호확인 데이터블록 실제로데이터가저장되는부분 5

6 파일정보검색 [1] 파일명으로파일정보검색 : stat(2) #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> int stat(const char *restrict path, struct stat *buf); inode 에저장된파일정보검색 path 에검색할파일의경로지정 - 검색한정보를 buf 에저장 stat 구조체 struct stat { dev_t ino_t mode_t nlink_t uid_t gid_t dev_t off_t time_t time_t time_t blksize_t blkcnt_t char }; st_dev; st_ino; st_mode; st_nlink; st_uid; st_gid; st_rdev; st_size; st_atime; st_mtime; st_ctime; st_blksize; st_blocks; st_fstype[_st_fstypsz]; 6

7 [ 예제 3-1] 파일명으로 inode 정보검색하기 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <stdio.h> int main(void) { 06 struct stat buf; stat("unix.txt", &buf); printf("inode = %d\n", (int)buf.st_ino); 11 printf("mode = %o\n", (unsigned int)buf.st_mode); 12 printf("nlink = %o\n",(unsigned int) buf.st_nlink); 13 printf("uid = %d\n", (int)buf.st_uid); 14 printf("gid = %d\n", (int)buf.st_gid); 15 printf("size = %d\n", (int)buf.st_size); 16 printf("atime = %d\n", (int)buf.st_atime); 17 printf("mtime = %d\n", (int)buf.st_mtime); 18 printf("ctime = %d\n", (int)buf.st_ctime); 19 printf("blksize = %d\n", (int)buf.st_blksize); 20 printf("blocks = %d\n", (int)buf.st_blocks); 21 //printf("fstype = %s\n", buf.st_fstype); return 0; 24 } # ex3_1.out Inode = 192 Mode = Nlink = 1 UID = 0 GID = 1 SIZE = 24 Atime = Mtime = Ctime = Blksize = 8192 Blocks = 2 UNIX time: 1970/1/1 00:00:00 (UTC) 부터경과한초 7

8 파일정보검색 [2] 파일기술자로파일정보검색 : fstat(2) #include <sys/types.h> #include <sys/stat.h> int fstat(int fd, struct stat *buf); fd 로지정한파일의정보를검색하여 buf 에저장 8

9 파일접근권한제어 stat 구조체의 st_mode 항목에파일의종류와접근권한정보저장 st_mode 값의구조 9

10 파일접근권한제어 chmod 명령어 파일 / 디렉토리의접근권한을변경 chmod 755 test.out - st_mode 의하위 9 비트를 로변경 chmod -R 644 testdir1 - testdir1 을포함한모든하위파일 / 디렉토리를 644 로변경 10

11 파일종류검색 [1] 상수를이용한파일종류검색 파일의종류검색관련상수 st_mode 값과 S_IFMT 을 AND(&) 연산하면파일의종류부분만남음 11

12 [ 예제 3-3] 상수를이용해파일종류검색하기 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <stdio.h> int main(void) { 06 struct stat buf; 07 int kind; stat("unix.txt", &buf); printf("mode = %o (16진수: %x)\n", (unsigned int)buf.st_mode, (unsigned int)buf.st_mode); kind = buf.st_mode & S_IFMT; 14 printf("kind = %x\n", kind); switch (kind) { 17 case S_IFIFO: 18 printf("unix.txt : FIFO\n"); 19 break; 20 case S_IFDIR: 21 printf("unix.txt : Directory\n"); 22 break; 12

13 [ 예제 3-3] 상수를이용해파일종류검색하기 23 case S_IFREG: 24 printf("unix.txt : Regular File\n"); 25 break; 26 } return 0; 29 } # ex3_3.out Mode = (16 진수 : 81a4) Kind = 8000 unix.txt : Regular File 13

14 파일종류검색 [2] 매크로를이용한파일종류검색 각매크로는 mode 값을 0xF000 과 AND 연산수행 AND 연산의결과를파일의종류별로정해진값과비교 14

15 [ 예제 3-4] 매크로를이용해파일종류검색하기 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <stdio.h> int main(void) { 06 struct stat buf; stat("unix.txt", &buf); # ex3_4.out Mode = (16 진수 : 81a4) unix.txt : Regular File 09 printf("mode = %o (16 진수 : %x)\n",(unsigned int)buf.st_mode, (unsigned int)buf.st_mode); if(s_isfifo(buf.st_mode)) printf("unix.txt : FIFO\n"); 13 if(s_isdir(buf.st_mode)) printf("unix.txt : Directory\n"); 14 if(s_isreg(buf.st_mode)) printf("unix.txt : Regular File\n"); return 0; 17 } 15

16 파일접근권한검색 [3] 함수를사용한파일접근권한검색 : access(2) #include <unistd.h> int access(const char *path, int amode); path 에지정된파일이 amode 로지정한권한을가졌는지확인 접근권한이있으면 0 을, 오류가있으면 -1 을리턴 오류메시지 - ENOENT : 파일이없음 - EACCESS : 접근권한이없음 amode - R_OK : 읽기권한확인 - W_OK : 쓰기권한확인 - X_OK : 실행권한확인 - F_OK : 파일이존재하는지확인 19

17 [ 예제 3-6] access 함수를이용해접근권한검색하기 01 #include <sys/errno.h> 02 #include <unistd.h> 03 #include <stdio.h> extern int errno; int main(void) { 08 int per; 09 # ls -l unix* -rw-r--r-- 1 root other 24 1월 8일 15:47 unix.txt # ex3_6.out unix.bak: File not exist. unix.txt: Read permission is permitted. 10 if (access("unix.bak", F_OK) == -1 && errno == ENOENT) 11 printf("unix.bak: File not exist.\n"); per = access("unix.txt", R_OK); 14 if (per == 0) 15 printf("unix.txt: Read permission is permitted.\n"); 16 else if (per == -1 && errno == EACCES) 17 printf("unix.txt: Read permission is not permitted.\n"); return 0; 20 } 20

18 파일접근권한변경 파일명으로접근권한변경 : chmod(2) #include <sys/types.h> #include <sys/stat.h> int chmod(const char *path, mode_t mode); path 에지정한파일의접근권한을 mode 값으로변경 접근권한추가 - OR 연산자 - chmod(path, S_IRWXU S_IRGRP S_IXGRP S_IROTH); - mode = S_IWGRP; 접근권한제거 - NOT 연산후 AND 연산자 - mode &= ~(S_IROTH); 파일기술자로접근권한변경 : fchmod(2) #include <sys/types.h> #include <sys/stat.h> int fchmod(int fd, mode_t mode); 21

19 파일접근권한변경 POSIX 에서정의한접근권한관련상수 시프트연산없이직접 AND 연산이가능한상수정의 22

20 [ 예제 3-7] chmod 함수사용하기 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <stdio.h> int main(void) { 06 struct stat buf; 07 # ls -l unix.txt -rw-r--r-- 1 root other 24 1월 8일 15:47 unix.txt # ex3_7.out 1.Mode = Mode = # ls -l unix.txt -rwxrwx--- 1 root other 24 1월 8일 15:47 unix.txt 08 chmod("unix.txt", S_IRWXU S_IRGRP S_IXGRP S_IROTH); 09 stat("unix.txt", &buf); 10 printf("1.mode = %o\n", (unsigned int)buf.st_mode); chmod("unix.txt", 0770); 0770? 13 stat("unix.txt", &buf); 14 printf("2.mode = %o\n", (unsigned int)buf.st_mode); return 0; 17 } 23

21 링크파일생성 [1] 링크 이미있는파일이나디렉토리에접근할수있는새로운이름 같은파일 / 디렉토리지만여러이름으로접근할수있게한다 하드링크 : 기존파일과동일한 inode 사용, inode 에저장된링크개수증가 - ln original.txt link.txt 심볼릭링크 : 기존파일에접근하는다른파일생성 ( 다른 inode 사용 ) - ln -s original.txt link.txt 하드링크생성 : link(2) #include <unistd.h> int link(const char *existing, const char *new); 두경로는같은파일시스템에존재해야함 24

22 [ 예제 3-8] link 함수사용하기 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <unistd.h> 04 #include <stdio.h> int main(void) { 07 struct stat buf; stat("unix.txt", &buf); # ls -l unix* -rwxrwx--- 1 root other 24 1월 8일 15:47 unix.txt # ex3_8.out Before Link Count = 1 After Link Count = 2 # ls -l unix* -rwxrwx--- 2 root other 24 1월 8일 15:47 unix.ln -rwxrwx--- 2 root other 24 1월 8일 15:47 unix.txt 10 printf("before Link Count = %d\n", (int)buf.st_nlink); link("unix.txt", "unix.ln"); stat("unix.txt", &buf); 15 printf("after Link Count = %d\n", (int)buf.st_nlink); return 0; 18 } 25

23 링크파일생성 [2] 심볼릭링크생성 : symlink(2) #include <unistd.h> int symlink(const char *name1, const char *name2); 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <unistd.h> int main(void) { 06 symlink("unix.txt", "unix.sym"); return 0; 09 } # ls -l unix* -rwxrwx--- 2 root other 24 1월 8일 15:47 unix.ln -rwxrwx--- 2 root other 24 1월 8일 15:47 unix.txt # ex3_9.out # ls -l unix* -rwxrwx--- 2 root other 24 1월 8일 15:47 unix.ln lrwxrwxrwx 1 root other 8 1월 11일 18:48 unix.sym -> unix.txt -rwxrwx--- 2 root other 24 1월 8일 15:47 unix.txt 26

24 심볼릭링크정보검색 심볼릭링크정보검색 : lstat(2) #include <sys/types.h> #include <sys/stat.h> int lstat(const char *path, struct stat *buf); lstat : 심볼릭링크자체의파일정보검색 심볼릭링크를 stat 함수로검색하면원본파일에대한정보를검색 심볼릭링크의내용읽기 : readlink(2) #include <unistd.h> ssize_t readlink(const char *restrict path, char size_t bufsiz); *restrict buf, 심볼릭링크의데이터블록에저장된내용읽기 원본파일의경로읽기 : realpath(3) #include <stdlib.h> char *realpath(const char *restrict file_name, char *restrict resolved_name); 심볼릭링크가가리키는원본파일의실제경로명출력 27

25 디렉토리관련함수 [1] 디렉토리생성 : mkdir(2) #include <sys/types.h> #include <sys/stat.h> int mkdir(const char *path, mode_t mode); path 에지정한디렉토리를 mode 권한에따라생성 디렉토리삭제 : rmdir(2) #include <unistd.h> int rmdir(const char *path); 디렉토리명변경 : rename(2) #include <stdio.h> int rename(const char *old, const char *new); 33

26 [ 예제 3-13] 디렉토리생성 / 삭제 / 이름변경하기 01 #include <sys/stat.h> 02 #include <unistd.h> 03 #include <stdlib.h> 04 #include <stdio.h> int main(void) { 07 if (mkdir("han", 0755) == -1) { 08 perror("han"); 09 exit(1); 10 } if (mkdir("bit", 0755) == -1) { 13 perror("bit"); 14 exit(1); 15 } if (rename("han", "hanbit") == -1) { 18 perror("hanbit"); 19 exit(1); 20 } 21 han -> hanbit 로변경 34

27 [ 예제 3-13] 디렉토리생성 / 삭제 / 이름변경하기 22 if (rmdir("bit") == -1) { 23 perror("bit"); 24 exit(1); 25 } return 0; 28 } bit 는생성했다삭제 # ex3_13.out # ls -l drwxr-xr-x 2 root other 512 1월 12일 18:06 hanbit 35

28 디렉토리관련함수 [2] 현재작업디렉토리위치 : getcwd(3) #include <unistd.h> char *getcwd(char *buf, size_t size); 현재작업디렉토리위치를알려주는명령은 pwd, 함수는 getcwd 디렉토리이동 : chdir(2) #include <unistd.h> int chdir(const char *path); 36

29 [ 예제 3-14] 작업디렉토리위치검색 / 디렉토리이동하기 01 #include <unistd.h> 02 #include <stdio.h> int main(void) { 05 char *cwd; 06 char wd[bufsiz]; cwd = getcwd(null, BUFSIZ); 09 printf("1.current Directory : %s\n", cwd); chdir("hanbit"); getcwd(wd, BUFSIZ); 14 printf("2.current Directory : %s\n", wd); return 0; 17 } # ex3_14.out 1.Current Directory : /export/home/jw/syspro/ch3 2.Current Directory : /export/home/jw/syspro/ch3/hanbit 37

30 디렉토리정보검색 [1] 디렉토리열기 : opendir(3) #include <sys/types.h> #include <dirent.h> DIR *opendir(const char *dirname); typedef struct dirent { ino_t d_ino; off_t d_off; unsigned short d_reclen; char d_name[name_max+1]; } dirent_t; 성공하면열린디렉토리를가리키는 DIR 포인터를리턴 디렉토리닫기 : closedir(3) #include <sys/types.h> #include <dirent.h> int closedir(dir *dirp); 디렉토리정보읽기 : readdir(3) #include <sys/types.h> #include <dirent.h> struct dirent *readdir(dir *dirp); 디렉토리의내용을한번에하나씩읽어옴 38

31 [ 예제 3-15] 디렉토리열고정보읽기 01 #include <dirent.h> 02 #include <stdlib.h> # ex3_15.out 03 #include <stdio.h> Name :. Inode : Name :.. Inode : int main(void) { 06 DIR *dp; 07 struct dirent *dent; if ((dp = opendir("hanbit")) == NULL) { 10 perror("opendir: hanbit"); 11 exit(1); 12 } while ((dent = readdir(dp))) { 15 printf("name : %s ", dent->d_name); 16 printf("inode : %d\n", (int)dent->d_ino); 17 } closedir(dp); return 0; 22 } 39

32 [ 예제 3-16] 디렉토리항목의상세정보검색하기 01 #include <sys/types.h> 02 #include <sys/stat.h> 03 #include <dirent.h> 04 #include <stdlib.h> 05 #include <stdio.h> int main(void) { 08 DIR *dp; 09 struct dirent *dent; 10 struct stat sbuf; 11 char path[bufsiz]; if ((dp = opendir("hanbit")) == NULL) { 14 perror("opendir: hanbit"); 15 exit(1); 16 } 18 while ((dent = readdir(dp))) { 19 if (dent->d_name[0] == '.') continue; 20 else break; 21 } 22 40

33 [ 예제 3-16] 디렉토리항목의상세정보검색하기 23 sprintf(path, "hanbit/%s", dent->d_name); 24 stat(path, &sbuf); printf("name : %s\n", dent->d_name); 27 printf("inode(dirent) : %d\n", (int)dent->d_ino); 28 printf("inode(stat) : %d\n", (int)sbuf.st_ino); 29 printf("mode : %o\n", (unsigned int)sbuf.st_mode); 30 printf("uid : %d\n", (int)sbuf.st_uid); closedir(dp); return 0; 35 } 디렉토리의항목을읽고다시 stat 함수로상세정보검색 # ls -ai hanbit han.c # ex3_16.out Name : han.c Inode(dirent) : 213 Inode(stat) : 213 Mode : Uid : 0 41

34 디렉토리정보검색 [2] 디렉토리오프셋 : telldir(3), seekdir(3), rewinddir(3) #include <dirent.h> long telldir(dir *dirp); void seekdir(dir *dirp, long loc); void rewinddir(dir *dirp); telldir : 디렉토리오프셋의현재위치를알려줌 seekdir : 디렉토리오프셋을 loc 에지정한위치로이동 rewinddir : 디렉토리오프셋을디렉토의시작인 0 으로이동 42

35 Exercise Ex. 특정디렉토리내의모든파일이름과 inode 번호를출력하는프로그램을작성./a.out /tmp/dirtest a.out debug hello hello.c perr.c winscp437.zip 45

36 Exercise - Extra Ex. 특정디렉토리내의모든파일이름과 inode 번호를출력하는프로그램을작성 하위에디렉토리가있을경우 recursive 로출력./a.out /tmp/dirtest a.out debug dir dir1/hello.c dir1/perr.c winscp437.zip 46

<4D F736F F F696E74202D FC6C4C0CFB0FA20B5F0B7BAC5E4B8AE205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FC6C4C0CFB0FA20B5F0B7BAC5E4B8AE205BC8A3C8AF20B8F0B5E55D> 학습목표 유닉스파일의특징을이해한다. 파일에관한정보를검색하는함수를사용할수있다. 하드링크와심볼릭링크파일을이해하고관련함수를사용할수있다. 파일사용권한을검색하고조정하는함수를사용할수있다. 디렉토리의특징을이해한다. 디렉토리의내용을검색하는함수를사용할수있다. 디렉토리를생성하고삭제하는함수를사용할수있다. 파일과디렉토리 IT CookBook, 유닉스시스템프로그래밍 2/45 목차

More information

Microsoft PowerPoint - 09_FileSystem

Microsoft PowerPoint - 09_FileSystem Linux 파일시스템프로그래밍 File System Programming - 파일시스템내부구조 - File Descriptor - File 기본작업시스템호출 - File 정보관리시스템호출 - Directory 관리시스템호출 이제부터는 시스템사용에만머물지않는다. 내부로들어가서건드려보고나만의시스템을만들자. 시스템호출 ( 또는표준 API) 을이용하여운영체제기능을프로그램에서사용

More information

Microsoft PowerPoint - chap3 [호환 모드]

Microsoft PowerPoint - chap3 [호환 모드] 제 3 장파일과디렉토리 숙대창병모 1 목표 파일시스템구현을이해한다. 파일의상태및구조를이해한다. 디렉토리구조및구현을이해한다. 숙대창병모 2 내용 1. 파일시스템구현 2. 파일상태 3. 파일접근허가권 4. 링크 5. 디렉토리 숙대창병모 3 3.1 파일시스템구현 숙대창병모 4 Inode (Index node) 한파일은하나의 i-node 를갖는다. 파일에대한모든정보를가지고있음

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 5 장파일시스템 상지대학교컴퓨터공학과고광만 kkman@sangji.ac.kr http://compiler.sangji.ac.kr 2018 5.1 파일시스템구현 파일시스템구조 0 1 2 3 200 201 부트블록슈퍼블록 i-노드 1..40 i-노드 41..80... 데이터블록데이터블록... i- 리스트 데이터블록 데이터블록 3 파일시스템구조 부트블록 (Boot

More information

Microsoft PowerPoint APUE(Files and Directories).ppt

Microsoft PowerPoint APUE(Files and Directories).ppt 컴퓨터특강 () [Ch. 4] 2006 년봄학기 문양세강원대학교컴퓨터과학과 강의목표및내용 강의목표 파일의상태및구조를이해한다. 파일시스템구현을이해한다. 디렉토리구조및구현을이해한다. 강의내용 파일상태 파일접근허가권 파일시스템구현 링크 (link) 디렉토리 Page 2 1 stat() 파일상태확인 #include #include

More information

Discrete Mathematics

Discrete Mathematics 컴퓨터특강 () [Ch. 4] 2005 년봄학기 문양세컴퓨터과학과강원대학교자연과학대학 강의목표및내용 강의목표 파일의상태및구조를이해한다. 파일시스템구현을이해한다. 디렉토리구조및구현을이해한다. 강의내용 파일상태 파일접근허가권 파일시스템구현 링크 (link) 디렉토리 Page 2 stat() 파일상태확인 #include #include

More information

슬라이드 1

슬라이드 1 / 유닉스시스템개요 / 파일 / 프로세스 01 File Descriptor file file descriptor file type unix 에서의파일은단지바이트들의나열임 operating system 은파일에어떤포맷도부과하지않음 파일의내용은바이트단위로주소를줄수있음 file descriptor 는 0 이나양수임 file 은 open 이나 creat 로 file

More information

[ 컴퓨터시스템 ] 3 주차 1 차시. 디렉토리사이의이동 3 주차 1 차시디렉토리사이의이동 학습목표 1. pwd 명령을사용하여현재디렉토리를확인할수있다. 2. cd 명령을사용하여다른디렉토리로이동할수있다. 3. ls 명령을사용하여디렉토리내의파일목록을옵션에따라다양하게확인할수

[ 컴퓨터시스템 ] 3 주차 1 차시. 디렉토리사이의이동 3 주차 1 차시디렉토리사이의이동 학습목표 1. pwd 명령을사용하여현재디렉토리를확인할수있다. 2. cd 명령을사용하여다른디렉토리로이동할수있다. 3. ls 명령을사용하여디렉토리내의파일목록을옵션에따라다양하게확인할수 3 주차 1 차시디렉토리사이의이동 학습목표 1. pwd 명령을사용하여현재디렉토리를확인할수있다. 2. cd 명령을사용하여다른디렉토리로이동할수있다. 3. ls 명령을사용하여디렉토리내의파일목록을옵션에따라다양하게확인할수있다. 학습내용 1 : 현재디렉토리확인 1. 홈디렉토리 - 로그인을한후, 사용자가기본으로놓이게되는디렉토리위치를홈디렉토리 (home directory)

More information

Microsoft PowerPoint - ch09_파이프 [호환 모드]

Microsoft PowerPoint - ch09_파이프 [호환 모드] 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 파이프 IT CookBook, 유닉스시스템프로그래밍 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 파이프 IT CookBook, 유닉스시스템프로그래밍 학습목표 파이프를이용한 IPC 기법을이해한다. 이름없는파이프를이용해통신프로그램을작성할수있다. 이름있는파이프를이용해통신프로그램을작성할수있다. 2/20 목차 파이프의개념 이름없는파이프만들기 복잡한파이프생성 양방향파이프활용 이름있는파이프만들기 3/20 파이프의개념 파이프 두프로세스간에통신할수있도록해주는특수파일 그냥파이프라고하면일반적으로이름없는파이프를의미

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

로봇SW교육원 강의자료

로봇SW교육원 강의자료 UNIT 05 make 광운대학교로봇 SW 교육원 최상훈 학습목표 2 Makefile 을작성핛수있다. make 3 make 프로젝트관리유틸리티 컴파일시갂단축 파일의종속구조를빠르게파악핛수있음 기술파일 (Makefile) 에기술된대로컴파일명령또는셸 (shell) 명령을순차적으로수행 make 를사용하지않을경우 $ gcc c main.c $ gcc c test_a.c

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

학번 : 이름 : 1. 다음파일트리구조를가진유닉스시스템이있다고가정하자. / /bin/ /home/ /home/taesoo/ /usr/ /usr/lib/ /usr/local/lib /media 모든폴더에파일이하나도없다고가정했을때사용자가터미널에서다음 ls 명령입력시화면출력

학번 : 이름 : 1. 다음파일트리구조를가진유닉스시스템이있다고가정하자. / /bin/ /home/ /home/taesoo/ /usr/ /usr/lib/ /usr/local/lib /media 모든폴더에파일이하나도없다고가정했을때사용자가터미널에서다음 ls 명령입력시화면출력 학번 : 이름 : 1. 다음파일트리구조를가진유닉스시스템이있다고가정하자. / /bin/ /home/ /home/taesoo/ /usr/ /usr/lib/ /usr/local/lib /media 모든폴더에파일이하나도없다고가정했을때사용자가터미널에서다음 ls 명령입력시화면출력을예측하시오. $ cd /usr $ ls..? $ ls.? 2. 다음그림은어떤프로세스가다음코드를수행했다는가정에서도시되었다.

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 4 장파일 컴퓨터과학과박환수 1 2 4.1 시스템호출 컴퓨터시스템구조 유닉스커널 (kernel) 하드웨어를운영관리하여다음과같은서비스를제공 파일관리 (File management) 프로세스관리 (Process management) 메모리관리 (Memory management) 통신관리 (Communication management) 주변장치관리 (Device

More information

10.

10. 10. 10.1 10.2 Library Routine: void perror (char* str) perror( ) str Error 0 10.3 10.3 int fd; /* */ fd = open (filename, ) /*, */ if (fd = = -1) { /* */ } fcnt1 (fd, ); /* */ read (fd, ); /* */ write

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

/chroot/lib/ /chroot/etc/

/chroot/lib/ /chroot/etc/ 구축 환경 VirtualBox - Fedora 15 (kernel : 2.6.40.4-5.fc15.i686.PAE) 작동 원리 chroot유저 ssh 접속 -> 접속유저의 홈디렉토리 밑.ssh의 rc 파일 실행 -> daemonstart실행 -> daemon 작동 -> 접속 유저만의 Jail 디렉토리 생성 -> 접속 유저의.bashrc 의 chroot 명령어

More information

제12장 파일 입출력

제12장 파일 입출력 제 4 장파일입출력 리눅스시스템프로그래밍 청주대학교전자공학과 한철수 1 시스템호출 (system call) 파일 (file) 임의접근 (random access) 주요학습내용 2 4.1 절 커널의역할 (kernel) 커널 (kernel) 은운영체제의핵심부분으로서, 하드웨어를운영관리하는여러가지서비스를제공함 파일관리 (File management) 디스크 프로세스관리

More information

Microsoft PowerPoint - lab14.pptx

Microsoft PowerPoint - lab14.pptx Mobile & Embedded System Lab. Dept. of Computer Engineering Kyung Hee Univ. Keypad Device Control in Embedded Linux HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착되어있다. 2 Keypad Device Driver

More information

벤처연구사업(전동휠체어) 평가

벤처연구사업(전동휠체어) 평가 운영체제실습 리눅스기본명령어 2019. 4 표월성 wspyo74@naver.com cherub.sungkyul.ac.kr 목차 Ⅰ. 기본명령어 1. 시스템정보 2. 파일및디렉토리명령어 시스템정보 1. 시스템정보출력 시스템정보출력 uname - 시스템정보출력 파일및디렉토리관련 명령어 파일및디렉토리 파일 (File) - 데이터를저장하기위해사용되는객체 ( 텍스트파일,

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 메모리매핑 IT CookBook, 유닉스시스템프로그래밍 학습목표 통신프로그램이무엇인지이해한다. 메모리매핑을이용한 IPC 기법을이해한다. 메모리매핑함수를사용해프로그램을작성할수있다. 2/20 목차 메모리매핑의개념 메모리매핑함수 메모리매핑해제함수 메모리매핑의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 3/20 메모리매핑의개념 메모리매핑 파일을프로세스의메모리에매핑

More information

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FB8DEB8F0B8AE20B8C5C7CE205BC8A3C8AF20B8F0B5E55D> 학습목표 통신프로그램이무엇인지이해한다. 을이용한 IPC 기법을이해한다. 함수를사용해프로그램을작성할수있다. IT CookBook, 유닉스시스템프로그래밍 2/20 목차 의개념 함수 해제함수 의보호모드변경 파일의크기확장 매핑된메모리동기화 데이터교환하기 의개념 파일을프로세스의메모리에매핑 프로세스에전달할데이터를저장한파일을직접프로세스의가상주소공간으로매핑 read, write

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 05. 파일접근권한관리하기 00. 개요 01. 파일의속성 02. 파일의접근권한 03. 기호를이용한파일접근권한변경 04. 숫자를이용한파일접근권한변경 05. 기본접근권한설정 06. 특수접근권한 파일의속성을이해하고설명할수있다. 접근권한의종류와표기방법을이해하고설명할수있다. 접근권한을바꾸기위해기호모드에서원하는권한을기호로표기할수있다. 접근권한을바꾸기위해숫자모드에서원하는권한을숫자로표기할수있다.

More information

Chapter 05. 파일접근권한관리하기

Chapter 05. 파일접근권한관리하기 Chapter 05. 파일접근권한관리하기 00. 개요 01. 파일의속성 02. 파일의접근권한 03. 기호를이용한파일접근권한변경 04. 숫자를이용한파일접근권한변경 05. 기본접근권한설정 06. 특수접근권한 파일의속성을이해하고설명할수있다. 접근권한의종류와표기방법을이해하고설명할수있다. 접근권한을바꾸기위해기호모드에서원하는권한을기호로표기할수있다. 접근권한을바꾸기위해숫자모드에서원하는권한을숫자로표기할수있다.

More information

ABC 11장

ABC 11장 12 장고급응용 0 수행중인프로그램 프로세스 모든프로세스는유일한프로세스식별번호 (PID) 를가짐 유닉스에서는 ps 명령을사용하여프로세스목록을볼수있음 12-1 프로세스 $ ps -aux USER PID %CPU %MEM SZ RSS TT STAT START TIME COMMAND blufox 17725 34.0 1.6 146 105 i2 R 15:13 0:00

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 유닉스시스템프로그래밍개요 IT CookBook, 유닉스시스템프로그래밍 학습목표 유닉스시스템관련표준을이해한다. 유닉스시스템프로그래밍이무엇인지이해한다. 시스템호출과라이브러리함수의차이를이해한다. 유닉스시스템의기본명령을사용할수있다. C 컴파일러와 make 도구를사용할수있다. 2/27 목차 유닉스시스템의역사 유닉스시스템표준 유닉스시스템프로그래밍이란 시스템호출과라이브러리함수의비교

More information

Microsoft PowerPoint APUE(File InO).pptx

Microsoft PowerPoint APUE(File InO).pptx Linux/UNIX Programming 문양세강원대학교 IT대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

학번 : 이름 : 1. 다음파일트리구조를가진유닉스시스템이있다. / /bin/ /home/ /home/taesoo/ /home/taesoo/downloads /usr/ /usr/lib/ /usr/local/lib /media 모든폴더에파일이하나도없다고가정했을때사용자 (t

학번 : 이름 : 1. 다음파일트리구조를가진유닉스시스템이있다. / /bin/ /home/ /home/taesoo/ /home/taesoo/downloads /usr/ /usr/lib/ /usr/local/lib /media 모든폴더에파일이하나도없다고가정했을때사용자 (t 학번 : 이름 : 1. 다음파일트리구조를가진유닉스시스템이있다. / /bin/ /home/ /home/taesoo/ /home/taesoo/downloads /usr/ /usr/lib/ /usr/local/lib /media 모든폴더에파일이하나도없다고가정했을때사용자 (taesoo) 가터미널에서다음 ls 명령입력시화면출력을예측하시오. $ ls /usr/.. $

More information

Microsoft PowerPoint APUE(File InO)

Microsoft PowerPoint APUE(File InO) Linux/UNIX Programming 문양세강원대학교 IT특성화대학컴퓨터과학전공 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 What is a File? A file is a contiguous

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 소켓프로그래밍활용 IT CookBook, 유닉스시스템프로그래밍 학습목표 소켓인터페이스를활용한다양한프로그램을작성할수있다. 2/23 목차 TCP 기반프로그래밍 반복서버 동시동작서버 동시동작서버-exec함수사용하기 동시동작서버-명령행인자로소켓기술자전달하기 UDP 프로그래밍 3/23 TCP 기반프로그래밍 반복서버 데몬프로세스가직접모든클라이언트의요청을차례로처리 동시동작서버

More information

Microsoft PowerPoint - u3.ppt [호환 모드]

Microsoft PowerPoint - u3.ppt [호환 모드] 3.1 계층적파일시스템 3. 파일시스템사용 파일 (file) 디스크에저장되는자료들의모음 파일이름을사용하여자료들을간편하게다룸 계층적파일시스템 디렉토리 (directory) 포함하고있는파일또는디렉토리이름과관련정보보관 (cf) 폴더 (folder) 1 2 파일유형과파일이름 경로이름 파일유형 일반파일 (regular file) 디렉토리파일 특수파일 입출력장치정보보관,

More information

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2 제 17 장동적메모리와연결리스트 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Sensor Device Jo, Heeseung Sensor 실습 HBE-SM5-S4210 에는근접 / 가속도 / 컴파스센서가장착 각센서들을사용하기위한디바이스드라이버와어플리케이션을작성 2 근접 (Proximity) 센서 HBE-SM5-S4210 Camera Module 근접센서디바이스 근접센서는사물이다른사물에접촉되기이전에가까이접근하였는지를검출할목적으로사용 일반적으로생활에서자동문이나엘리베이터,

More information

Adobe Flash 취약점 분석 (CVE-2012-0754)

Adobe Flash 취약점 분석 (CVE-2012-0754) 기술문서 14. 08. 13. 작성 GNU C library dynamic linker $ORIGIN expansion Vulnerability Author : E-Mail : 윤지환 131ackcon@gmail.com Abstract 2010 년 Tavis Ormandy 에 의해 발견된 취약점으로써 정확한 명칭은 GNU C library dynamic linker

More information

Microsoft PowerPoint APUE(File InO).ppt

Microsoft PowerPoint APUE(File InO).ppt 컴퓨터특강 () [Ch. 3] 2006 년봄학기 문양세강원대학교컴퓨터과학과 강의목표및내용 강의목표 파일의특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 기타파일제어함수를익힌다. 강의내용 파일구조 (UNIX 파일은어떤구조일까?) 파일관련시스템호출 시스템호출의효율과구조 Page 2 1 What is a File? A file is a contiguous

More information

<4D F736F F F696E74202D FC7C1B7CEBCBCBDBA20BBFDBCBAB0FA20BDC7C7E0205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D FC7C1B7CEBCBCBDBA20BBFDBCBAB0FA20BDC7C7E0205BC8A3C8AF20B8F0B5E55D> 학습목표 프로세스를생성하는방법을이해한다. 프로세스를종료하는방법을이해한다. exec함수군으로새로운프로그램을실행하는방법을이해한다. 프로세스를동기화하는방법을이해한다. 프로세스생성과실행 IT CookBook, 유닉스시스템프로그래밍 2/24 목차 프로세스생성 프로세스종료함수 exec 함수군활용 exec 함수군과 fork 함수 프로세스동기화 프로세스생성 [1] 프로그램실행

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 프로세스생성과실행 IT CookBook, 유닉스시스템프로그래밍 학습목표 프로세스를생성하는방법을이해한다. 프로세스를종료하는방법을이해한다. exec함수군으로새로운프로그램을실행하는방법을이해한다. 프로세스를동기화하는방법을이해한다. 2/24 목차 프로세스생성 프로세스종료함수 exec 함수군활용 exec 함수군과 fork 함수 프로세스동기화 3/24 프로세스생성 [1]

More information

Microsoft PowerPoint - 10-EmbedSW-11-모듈

Microsoft PowerPoint - 10-EmbedSW-11-모듈 11. 개요 proc 파일시스템 순천향대학교컴퓨터학부이상정 1 개요 순천향대학교컴퓨터학부이상정 2 개요 커널프래그래밍 커널의일부변경시커널전체를다시컴파일해야하는번거로움 해당모듈만컴파일하고필요할때만동적으로링크시켜커널의일부로사용할수있어효율적 자주사용하지않는커널기능은메모리에상주시키지않아도됨 확장성과재사용성을높일수있음. 순천향대학교컴퓨터학부이상정 3 모듈 (module)

More information

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx #include int main(void) { int num; printf( Please enter an integer "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 을 작성하면서 C 프로그램의

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 UNIX 및실습 6 장. 파일접근권한관리하기 1 6 장. 파일접근권한관리하기 학습목표 파일의속성과접근권한의개념을이해한다. 접근권한을변경하는방법을익힌다. 접근권한을상속하고초기에설정하는방법을익힌다. 2 01. 파일의속성 다중사용자시스템의특징 여러사람이하나의시스템사용 다른사람이내파일을읽거나수정, 삭제할수없도록보안기능필요 다른사용자의무단접근으로부터자신의파일을보호하는기능으로파일에접근권한을부여하여권한만큼만파일을사용하도록함

More information

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 #define _CRT_SECURE_NO_WARNINGS #include #include main() { char ch; printf(" 문자 1개를입력하시오 : "); scanf("%c", &ch); if (isalpha(ch))

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

Chapter #01 Subject

Chapter #01  Subject Device Driver March 24, 2004 Kim, ki-hyeon 목차 1. 인터럽트처리복습 1. 인터럽트복습 입력검출방법 인터럽트방식, 폴링 (polling) 방식 인터럽트서비스등록함수 ( 커널에등록 ) int request_irq(unsigned int irq, void(*handler)(int,void*,struct pt_regs*), unsigned

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070> #include "stdafx.h" #include "Huffman.h" 1 /* 비트의부분을뽑아내는함수 */ unsigned HF::bits(unsigned x, int k, int j) return (x >> k) & ~(~0

More information

Microsoft PowerPoint - chap03-변수와데이터형.pptx

Microsoft PowerPoint - chap03-변수와데이터형.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num %d\n", num); return 0; } 1 학습목표 의 개념에 대해 알아본다.

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070> 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include "QuickSort.h" 7 using namespace std; 8 9 10 Node* Queue[100]; // 추가입력된데이터를저장하기위한 Queue

More information

Microsoft PowerPoint - chap10-함수의활용.pptx

Microsoft PowerPoint - chap10-함수의활용.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 중 값에 의한 전달 방법과

More information

Microsoft PowerPoint - chap11-포인터의활용.pptx

Microsoft PowerPoint - chap11-포인터의활용.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 포인터를 사용하는 다양한 방법에

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074> Chap #2 펌웨어작성을위한 C 언어 I http://www.smartdisplay.co.kr 강의계획 Chap1. 강의계획및디지털논리이론 Chap2. 펌웨어작성을위한 C 언어 I Chap3. 펌웨어작성을위한 C 언어 II Chap4. AT89S52 메모리구조 Chap5. SD-52 보드구성과코드메모리프로그래밍방법 Chap6. 어드레스디코딩 ( 매핑 ) 과어셈블리어코딩방법

More information

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures 단일연결리스트 (Singly Linked List) 신찬수 연결리스트 (linked list)? tail 서울부산수원용인 null item next 구조체복습 struct name_card { char name[20]; int date; } struct name_card a; // 구조체변수 a 선언 a.name 또는 a.date // 구조체 a의멤버접근 struct

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Error and Command Line Arguments Jo, Heeseung 학습목표 오류처리함수동적메모리할당명령행인자 2 오류처리함수 [1] 오류메시지출력 : perror(3) #include void perror(const char *s); [ 예제 1-4] perror 함수사용하기 01 #include 02

More information

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4 Introduction to software design 2012-1 Final 2012.06.13 16:00-18:00 Student ID: Name: - 1 - 0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x

More information

본 강의에 들어가기 전

본 강의에 들어가기 전 C 기초특강 종합과제 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 Unix 프로그래밍및실습 7 장. 시그널 - 과제보충 응용과제 1 부모프로세스는반복해서메뉴를출력하고사용자로부터주문을받아자식프로세스에게주문내용을알린다. (SIGUSR1) ( 일단주문을받으면음식이완료되기전까지 SIGUSR1 을제외한다른시그널은모두무시 ) timer 자식프로세스는주문을받으면조리를시작한다. ( 일단조리를시작하면음식이완성되기전까지 SIGALARM 을제외한다른시그널은모두무시

More information

vi 사용법

vi 사용법 네트워크프로그래밍 6 장과제샘플코드 - 1:1 채팅 (udp 버전 ) 과제 서버에서먼저 bind 하고그포트를다른사람에게알려줄것 클라이언트에서알려준포트로접속 서로간에키보드입력을받아상대방에게메시지전송 2 Makefile 1 SRC_DIR =../../common 2 COM_OBJS = $(SRC_DIR)/addressUtility.o $(SRC_DIR)/dieWithMessage.o

More information

C 프로그래밊 개요

C 프로그래밊 개요 구조체 2009 년 5 월 19 일 김경중 강의계획수정 일자계획 Quiz 실습보강 5 월 19 일 ( 화 ) 구조체 Quiz ( 함수 ) 5 월 21 일 ( 목 ) 구조체저녁 6 시 5 월 26 일 ( 화 ) 포인터 5 월 28 일 ( 목 ) 특강 (12:00-1:30) 6 월 2 일 ( 화 ) 포인터 Quiz ( 구조체 ) 저녁 6 시 6 월 4 일 ( 목

More information

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - [2009] 02.pptx 원시데이터유형과연산 원시데이터유형과연산 원시데이터유형과연산 숫자데이터유형 - 숫자데이터유형 원시데이터유형과연산 표준입출력함수 - printf 문 가장기본적인출력함수. (stdio.h) 문법 ) printf( Test printf. a = %d \n, a); printf( %d, %f, %c \n, a, b, c); #include #include

More information

컴파일러

컴파일러 YACC 응용예 Desktop Calculator 7/23 Lex 입력 수식문법을위한 lex 입력 : calc.l %{ #include calc.tab.h" %} %% [0-9]+ return(number) [ \t] \n return(0) \+ return('+') \* return('*'). { printf("'%c': illegal character\n",

More information

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어 개나리 연구소 C 언어 노트 (tyback.egloos.com) 프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어먹고 하더라구요. 그래서,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Text-LCD Device Control - Device driver Jo, Heeseung M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App 을개발 TextLCD 는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210 의 TextLCD 는 16 문자 *2 라인을 Display 할수있으며, 이 TextLCD 를제어하기위하여

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

Microsoft PowerPoint - chap12-고급기능.pptx

Microsoft PowerPoint - chap12-고급기능.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 가 제공하는 매크로 상수와 매크로

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 ERROR AND COMMAND LINE ARGUMENTS Jo, Heeseung 학습목표 오류처리함수 동적메모리할당 명령행인자 2 오류처리함수 [1] 오류메시지출력 : perror(3) #include void perror(const char *s); [ 예제 1-4] perror 함수사용하기 01 #include

More information

Microsoft PowerPoint - 08-C-App-19-Quick-Preprocessor

Microsoft PowerPoint - 08-C-App-19-Quick-Preprocessor 19. 전처리와분할컴파일 순천향대학교컴퓨터학부이상정 1 학습내용 전처리명령어 #include #define 기호상수 const 분할컴파일 순천향대학교컴퓨터학부이상정 2 전처리과정 전처리 (preprocessor) 전처리명령어는 # 기호로시작 #incldue #define 순천향대학교컴퓨터학부이상정 3 #include (1) 지정된파일을프로그램에삽입 꺽쇠괄호는포함할파일을컴파일러에설정되어있는특정디렉토리에서검색

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 파일입출력 Heeseung Jo 이장의내용 파일과파일포인터 파일입출력함수 임의접근파일처리 2 파일과파일포인터 파일 파일은모든데이터를연속된바이트형태로저장 4 C 언어의파일종류 텍스트파일 (text file) 사람들이읽을수있는문자들을저장하고있는파일 텍스트파일에서 " 한줄의끝 " 을나타내는표현은파일이읽어들여질때, C 내부의방식으로변환 예, a.txt, main.c,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 File I/O Jo, Heeseung 학습목표 오류처리함수동적메모리할당명령행인자 2 오류처리함수 [1] 오류메시지출력 : perror(3) #include void perror(const char *s); [ 예제 1-4] perror 함수사용하기 01 #include 02 #include 03

More information

3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터

3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터 - Part2-3 3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터 3.1 포인터란 ü ü ü. ü. ü. ü ( ) ? 3.1 ü. ü C ( ).? ü ü PART2-4 ü ( ) PART3-4 3.2 포인터변수의선언과사용 3.2 포인터 변수의 선언과 사용 (1/8) 포인터 변수의

More information

Microsoft PowerPoint - chap2

Microsoft PowerPoint - chap2 제 2 장. 파일입출력 (File I/O) 숙대창병모 1 목표 파일의구조및특성을이해한다. 파일을열고닫는다. 파일로부터데이터를읽고쓴다. 파일현재위치변경 기타파일제어 숙대창병모 2 2.1 파일구조 숙대창병모 3 What is a file? a file is a contiguous sequence of bytes no format imposed by the operating

More information

C 프로그래밍 언어 입문 C 프로그래밍 언어 입문 김명호저 숭실대학교 출판국 머리말..... C, C++, Java, Fortran, Python, Ruby,.. C. C 1972. 40 C.. C. 1999 C99. C99. C. C. C., kmh ssu.ac.kr.. ,. 2013 12 Contents 1장 프로그래밍 시작 1.1 C 10 1.2 12

More information

Microsoft PowerPoint - 09-Pipe

Microsoft PowerPoint - 09-Pipe 9. 파이프 상명대학교소프트웨어학부 파이프 시그널은이상한사건이나오류를처리하는데는이용하지만, 한프로세스로부터다른프로세스로대량의정보를전송하는데는부적합하다. 파이프 한프로세스를다른관련된프로세스에연결시켜주는단방향의통신채널 2 pipe() Usage #include int pipe(int filedes[2]); 3 < ex_1.c > #include

More information

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to  TCP/IP Sockets: C Version 인터넷프로토콜 5 장 데이터송수신 (3) 1 파일전송메시지구성예제 ( 고정크기메시지 ) 전송방식 : 고정크기 ( 바이너리전송 ) 필요한전송정보 파일이름 ( 최대 255 자 => 255byte 의메모리공간필요 ) 파일크기 (4byte 의경우최대 4GB 크기의파일처리가능 ) 파일내용 ( 가변길이, 0~4GB 크기 ) 메시지구성 FileName (255bytes)

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조 - Part2- 제 2 장다차원배열이란무엇인가 학습목차 2.1 다차원배열이란 2. 2 2 차원배열의주소와값의참조 2.1 다차원배열이란 2.1 다차원배열이란 (1/14) 다차원배열 : 2 차원이상의배열을의미 1 차원배열과다차원배열의비교 1 차원배열 int array [12] 행 2 차원배열 int array [4][3] 행 열 3 차원배열 int array [2][2][3]

More information

2009년 상반기 사업계획

2009년 상반기 사업계획 파일입출력 IT CookBook, 유닉스시스템프로그래밍 학습목표 유닉스에서파일입출력의특징을이해한다. 저수준파일입출력함수를사용할수있다. 고수준파일입출력함수를사용할수있다. 임시파일을생성해파일입출력을할수있다. 2/51 목차 저수준파일입출력 파일기술자 파일생성과열고닫기 파일읽기와쓰기 파일오프셋지정 파일기술자복사 파일기술자제어 파일삭제 고수준파일입출력 파일포인터 파일열기와닫기

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 9 장. 파이프 Unix 프로그래밍및실습 1 강의내용 1 절개요 2 절이름없는파이프 3 절이름있는파이프 http://lily.mmu.ac.kr/lecture/13u2/ch09.pdf 책에나온내용반드시 man 으로확인할것! UNIX, LINUX 등시스템마다차이가있을수있음을반드시인식 2 기본실습 #1 [ 예제 9-1] ~ [ 예제 9-7] ( 각 10점 ) 과제개요

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

untitled

untitled while do-while for break continue while( ) ; #include 0 i int main(void) int meter; int i = 0; while(i < 3) meter = i * 1609; printf("%d %d \n", i, meter); i++; return 0; i i< 3 () 0 (1)

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 14. 포인터와함수에대한이해 2013.10.09. 오병우 컴퓨터공학과 14-1 함수의인자로배열전달 기본적인인자의전달방식 값의복사에의한전달 val 10 a 10 11 Department of Computer Engineering 2 14-1 함수의인자로배열전달 배열의함수인자전달방식 배열이름 ( 배열주소, 포인터 ) 에의한전달 #include

More information

Unix 의 역사 Bell Lab의 Ken Tompson이 PDP-7 위에서 개발 (1969년) Dennis Ritchie가 참가하여 대부분을 C언어로 작성 Sixth Edition 개발 (1976년) 다른 기관이 사용할 수 있도록 배포한 최초의 버전 이후에 UNIX는

Unix 의 역사 Bell Lab의 Ken Tompson이 PDP-7 위에서 개발 (1969년) Dennis Ritchie가 참가하여 대부분을 C언어로 작성 Sixth Edition 개발 (1976년) 다른 기관이 사용할 수 있도록 배포한 최초의 버전 이후에 UNIX는 고급 시스템 프로그래밍 (소프트웨어 개발 트랙) 제1장 소개 2004. 08. 22 1 Unix 의 역사 Bell Lab의 Ken Tompson이 PDP-7 위에서 개발 (1969년) Dennis Ritchie가 참가하여 대부분을 C언어로 작성 Sixth Edition 개발 (1976년) 다른 기관이 사용할 수 있도록 배포한 최초의 버전 이후에 UNIX는 크게

More information

KEY 디바이스 드라이버

KEY 디바이스 드라이버 KEY 디바이스드라이버 임베디드시스템소프트웨어 I (http://et.smu.ac.kr et.smu.ac.kr) 차례 GPIO 및 Control Registers KEY 하드웨어구성 KEY Driver 프로그램 key-driver.c 시험응용프로그램 key-app.c KEY 디바이스드라이버 11-2 GPIO(General-Purpose Purpose I/O)

More information

Microsoft PowerPoint - 03_(Linux)_(Fundamental)_File_Directory

Microsoft PowerPoint - 03_(Linux)_(Fundamental)_File_Directory GNU/Linux 파일과디렉터리 Seo, Doo-Ok Clickseo.com clickseo@gmail.com 목 차 UNIX 파일시스템 파일과디렉터리 소유권과보호 데이터압축 2 파일 (File) UNIX 파일시스템 (1/9) UNIX 파일은임의의정보를포함하는 0 또는그이상의 Bytes 집합체 UNIX의파일구조는트리형태의계층적인형태 파일명과디스크에서물리적인파일위치를연결하는디렉터리항목을가지는파일

More information

Microsoft PowerPoint - Chapter_09.pptx

Microsoft PowerPoint - Chapter_09.pptx 프로그래밍 1 1 Chapter 9. Structures May, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 구조체의개념 (1/4) 2 (0,0) 구조체 : 다양한종류의데이터로구성된사용자정의데이터타입 복잡한자료를다루는것을편하게해줌 예 #1: 정수로이루어진 x,

More information

UI TASK & KEY EVENT

UI TASK & KEY EVENT T9 & AUTOMATA 2007. 3. 23 PLATFORM TEAM 정용학 차례 T9 개요 새로운언어 (LDB) 추가 T9 주요구조체 / 주요함수 Automata 개요 Automata 주요함수 추후세미나계획 질의응답및토의 T9 ( 2 / 30 ) T9 개요 일반적으로 cat 이라는단어를쓸려면... 기존모드 (multitap) 2,2,2, 2,8 ( 총 6번의입력

More information