ๆญฏ9์žฅ.PDF

Similar documents
chap7.key

Microsoft PowerPoint - chap13-์ž…์ถœ๋ ฅ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ.pptx

Microsoft PowerPoint - ์ œ11๊ฐ• ํŒŒ์ผ ์ฒ˜๋ฆฌ

<4D F736F F F696E74202D2034C5D8BDBAC6AEC6C4C0CFC0D4C3E2B7C2312E505054>

untitled

๊ธˆ์˜ค๊ณต๋Œ€ ์ปดํ“จํ„ฐ๊ณตํ•™์ „๊ณต ๊ฐ•์˜์ž๋ฃŒ

Microsoft PowerPoint - chap4 [ํ˜ธํ™˜ ๋ชจ๋“œ]

์Šฌ๋ผ์ด๋“œ 1

Microsoft PowerPoint - 09_(C_Programming)_(Korean)_File_Processing

C Programming

untitled


ร€ยฉยตยตยณร—ร†ยฎยฟรทร‡รยทรŽยฑร—ยทยกยนร–4ร€รฅ_รƒร–รยพ

Microsoft PowerPoint - 10_C_Language_Text_Files

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜


PowerPoint Template

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

Microsoft PowerPoint - Chap14_FileAccess.pptx

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

์ œ1์žฅ Unix๋ž€ ๋ฌด์—‡์ธ๊ฐ€?

int main(void) int a; int b; a=3; b=a+5; printf("a : %d \n", a); printf("b : %d \n", b); a b 3 a a+5 b &a(12ff60) &b(12ff54) 3 a 8 b printf(" a : %x \

Microsoft PowerPoint - Lesson13.pptx

: 1 int arr[9]; int n, i; printf(" : "); scanf("%d", &n); : : for(i=1; i<10; i++) arr[i-1] = n * i; for(i=0; i<9; i++) if(i%2 == 1) print

Microsoft PowerPoint APUE(Intro).ppt

BMP ํŒŒ์ผ ์ฒ˜๋ฆฌ

chap8.PDF

ABC 11์žฅ

11์žฅ ํฌ์ธํ„ฐ

K&R2 Reference Manual ๋ฒˆ์—ญ๋ณธ

Microsoft PowerPoint - chap11.ppt [ํ˜ธํ™˜ ๋ชจ๋“œ]

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

C ์–ธ์–ด ํ”„๋กœ๊ทธ๋ž˜๋ฐŠ ๊ณผ์ œ ํ’€์ด

Microsoft PowerPoint - chap11-1.ppt [ํ˜ธํ™˜ ๋ชจ๋“œ]

Computer Programming (2008 Fall)


์Šฌ๋ผ์ด๋“œ 1


13์ฃผ-14์ฃผproc.PDF

์ค‘๊ฐ„๊ณ ์‚ฌ

untitled

์—ฐ์Šต๋ฌธ์ œ๋งŒ-์ˆ˜์ •

์Šฌ๋ผ์ด๋“œ 1

, ( ),, ( ), 3, int kor[5]; int eng[5]; int Microsoft Windows 4 (ANSI C2 ) int kor[5] 20 # define #define SIZE 20 int a[10]; char c[10]; float

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

13 ์ฃผ์ฐจ๋ฌธ์ž์—ด์˜ํ‘œํ˜„๊ณผ์ž…์ถœ๋ ฅ

๋ณธ ๊ฐ•์˜์— ๋“ค์–ด๊ฐ€๊ธฐ ์ „

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

11์žฅ ํฌ์ธํ„ฐ

๊ธˆ์˜ค๊ณต๋Œ€ ์ปดํ“จํ„ฐ๊ณตํ•™์ „๊ณต ๊ฐ•์˜์ž๋ฃŒ

03แ„Œแ…กแ†ผ.แ„‰แ…ณแ„แ…ขแ†จ.key

ํ”„๋กœ๊ทธ๋žจ์„ ํ•™๊ต ๋“ฑ์ง€์—์„œ ์กฐ๊ธˆ์ด๋ผ๋„ ๋ฐฐ์šด ์‚ฌ๋žŒ๋“ค์„ ์œ„ํ•œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋…ธํŠธ ์ž…๋‹ˆ๋‹ค. ์ € ์—ญ์‹œ ๊ทธ ์‚ฌ๋žŒ๋“ค ์ค‘ ํ•˜๋‚˜ ์ž…๋‹ˆ๋‹ค. ์ค‘๊ณ ๋“ฑํ•™๊ต ์‹œ์ ˆ ํ•™๊ต ๋„์„œ๊ด€, ์ƒˆ๋กœ ์ƒ๊ธด ์‹œ๋ฆฝ ๋„์„œ๊ด€ ๋“ฑ์„ ๋‹ค๋‹ˆ๋ฉฐ ์ฑ…์„ ๋ณด ๊ณ  ์ •๋ฆฌํ•˜๋ฉฐ ์–ด๋Š์ •๋„ ๋…ํ•™์œผ๋ฅด ๊ณต๋ถ€ํ•˜๊ธด ํ–ˆ์ง€๋งŒ, ์ž์ฃผ ์•ˆํ•˜๋‹ค ๋ณด๋ฉด ๊ธˆ๋ฐฉ ์žŠ์–ด

๋ณธ ๊ฐ•์˜์— ๋“ค์–ด๊ฐ€๊ธฐ ์ „

C++-ยฟรยบยฎร‡ร˜ยผยณ10ร€รฅ

ๆญฏ7์žฅ.PDF

chap7.PDF

untitled

<4D F736F F F696E74202D D20B9AEC0DABFAD2C20BDBAC6AEB8B2B0FA20C6C4C0CF20C0D4C3E2B7C2>

์ œ7์žฅ C ํ‘œ์ค€ ํŒŒ์ผ ์ž…์ถœ๋ ฅ

์ œ7์žฅ C ํ‘œ์ค€ ํŒŒ์ผ ์ž…์ถœ๋ ฅ

์ œ1์žฅ Unix๋ž€ ๋ฌด์—‡์ธ๊ฐ€?

Microsoft PowerPoint - Lecture 4-1 Linux File Environment.ppt [ํ˜ธํ™˜ ๋ชจ๋“œ]

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

Microsoft PowerPoint - Ch12.ํŒŒ์ผ.pptx

6์ฃผ์ฐจ.key

Microsoft PowerPoint - Cํ”„๋กœ๊ทธ๋ž˜๋ฐ-chap15.ppt [ํ˜ธํ™˜ ๋ชจ๋“œ]

๋ฌธ์ œ๋Š”๋‹ค์–‘ํ•œ๋ฐฉ๋ฒ•์œผ๋กœํ’€์ˆ˜์žˆ์œผ๋ฉฐ, ๋‹ค์Œ์˜ํ’€์ด๋Š”์—ฌ๋Ÿฌํ•ด๋ฒ•์ค‘ํ•˜๋‚˜์ด๋‹ค. [ ๋ฌธ์ œ 1] ๋ฐ€๋„๊ตฌํ•˜๊ธฐ ์งˆ๋Ÿ‰๋ฐ€๋„ ์ด๋‹ค. ๋ฌผ์ฒด์˜์งˆ๋Ÿ‰ M๊ณผ๋ถ€ํ”ผ V๊ฐ€์ฃผ์–ด์ง€๋ฉด๋ฐ€๋„๋Š” M/V๋กœ๊ตฌํ• ์ˆ˜์žˆ๋‹ค. ๋ถ€ํ”ผ ์—ฌ๊ธฐ์„œ์งˆ๋Ÿ‰ M ๊ณผ๋ถ€ํ”ผ V ๋Š”์ •์ˆ˜์ด์ง€๋งŒ M/V ์€์‹ค์ˆ˜๊ฐ€๋ ์ˆ˜์žˆ๊ธฐ๋•Œ๋ฌธ์— M ๊ณผ V ๋ฅผ๋ฐ› ์„๋•Œ์‹ค์ˆ˜๋กœ์ž…๋ ฅ๋ฐ›๋Š”๋‹ค.

<4D F736F F F696E74202D20C1A63136C0E520C6C4C0CFC0D4C3E2B7C2>

Microsoft PowerPoint - C_Programming_Basics.ppt [ํ˜ธํ™˜ ๋ชจ๋“œ]

๋ฐ์ดํƒ€์ „์†ก

์ œ12์žฅ ํŒŒ์ผ ์ž…์ถœ๋ ฅ

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

untitled

12-file.key

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

11์žฅ ํฌ์ธํ„ฐ

ํ‘œ์ค€์ž…์ถœ๋ ฅ์ŠคํŠธ๋ฆผ ๊ธฐ๋ณธ์ ์ธ์ŠคํŠธ๋ฆผ๋“ค์€ํ”„๋กœ๊ทธ๋ž˜๋จธ๊ฐ€์ƒ์„ฑํ•˜์ง€์•Š์•„๋„์ž๋™์œผ๋กœ์ƒ์„ฑ๋œ๋‹ค. ์ด๋ฆ„์ŠคํŠธ๋ฆผ์—ฐ๊ฒฐ์žฅ์น˜ stdin ํ‘œ์ค€์ž…๋ ฅ์ŠคํŠธ๋ฆผํ‚ค๋ณด๋“œ stdout ํ‘œ์ค€์ถœ๋ ฅ์ŠคํŠธ๋ฆผ๋ชจ๋‹ˆํ„ฐ์˜ํ™”๋ฉด stderr ํ‘œ์ค€์˜ค๋ฅ˜์ŠคํŠธ๋ฆผ๋ชจ๋‹ˆํ„ฐ์˜ํ™”๋ฉด ์ž…์ถœ๋ ฅํ•จ์ˆ˜์˜๋ถ„๋ฅ˜ ์‚ฌ์šฉํ•˜๋Š”์ŠคํŠธ๋ฆผ์—๋”ฐ๋ฅธ๋ถ„๋ฅ˜ ํ‘œ์ค€์ž…์ถœ๋ ฅ์ŠคํŠธ๋ฆผ์„์‚ฌ์šฉํ•˜์—ฌ์ž…์ถœ๋ ฅ์„ํ•˜

Cํ”„๋กœ-3์žฅc03้€žํ’š

Microsoft PowerPoint - chap11-ํฌ์ธํ„ฐ์˜ํ™œ์šฉ.pptx

2007_2_project4

2009๋…„ ์ƒ๋ฐ˜๊ธฐ ์‚ฌ์—…๊ณ„ํš

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

Microsoft PowerPoint - chap1 [ํ˜ธํ™˜ ๋ชจ๋“œ]

๋ชฉ์ฐจ ๋ฐฐ์—ด์˜๊ฐœ์š” ๋ฐฐ์—ด์‚ฌ์šฉํ•˜๊ธฐ ๋‹ค์ฐจ์›๋ฐฐ์—ด ๋ฐฐ์—ด์„์ด์šฉํ•œ๋ฌธ์ž์—ด๋‹ค๋ฃจ๊ธฐ ์‹ค๋ฌด์‘์šฉ์˜ˆ์ œ C 2

Microsoft PowerPoint - [2009] 02.pptx

PowerPoint ํ”„๋ ˆ์  ํ…Œ์ด์…˜

11์žฅ ํฌ์ธํ„ฐ

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C4C656D70656C2D5A69762E637070>

Chapter_06

<4D F736F F F696E74202D D20B9AEC0DABFAD2C20BDBAC6AEB8B2B0FA20C6C4C0CF20C0D4C3E2B7C2>

์ œ1์žฅ Unix๋ž€ ๋ฌด์—‡์ธ๊ฐ€?

<4D F736F F F696E74202D FC6C4C0CF20C0D4C3E2B7C2205BC8A3C8AF20B8F0B5E55D>

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf("hihi\n"); } warning: conflicting types for functiona

์ œ 14 ์žฅํฌ์ธํ„ฐํ™œ์šฉ ์œ ์ค€๋ฒ” (JUNBEOM YOO) Ver ๋ณธ๊ฐ•์˜์ž๋ฃŒ๋Š”์ƒ๋Šฅ์ถœํŒ์‚ฌ์˜ PPT ๊ฐ•์˜์ž๋ฃŒ ๋ฅผ๊ธฐ๋ฐ˜์œผ๋กœ์ œ์ž‘๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๊ณ ๊ธ‰ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์„ค๊ณ„

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

Microsoft PowerPoint - 10์žฅ ๋ฌธ์ž์—ด pptx

10.

Microsoft PowerPoint - 08_(C_Programming)_(Korean)_Preprocessing

ๅ•†็”จ

Transcription:

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' (binary stream) : (file) open close exit() 3

C stdin standard input file 0 stdout standard output file 1 stderr standard error file 2 "stdioh" 4

printf() scanf() printf() print formatted printf() printf(, ); 5

printf() scanf() %d : int %ld : long %x : int 16 %lx : long 16 %o : int 8 %lo : long 8 %u : unsigned %lu : long unsigned %e : %f : %g : %e %f %p : %c : %s : 6

printf() scanf() [ 9-1] printf("%5d", a); [ ] 1234567 7

printf() scanf() [ 9-2] #include <stdioh> main() { float a, b; a = 150; b = 30; printf(" = %82f\n", a+b); printf(" = %82f\n", a-b); printf(" = %82f\n", a*b); printf(" = %82f\n", a/b); } [ ] = 1800 = 1200 = 4500 = 500 8

printf() scanf() scanf() scanf() printf() (call by reference) & scanf(, ); 9-3, 9-4 9

printf() scanf() [ 9-3] #include <stdioh> main() { int a, b; float average; } printf("input data = "); scanf("%d %d", &a, &b); average = (a+b)/2; printf("average of two numbers = %f\n",average); [ ] input data = 10, 20 average of two numbers = 15000000 10

printf() scanf() [ 9-4] #include <stdioh> main() { double x, y, average = 00; printf("input data(x, y) = "); scanf("%f %f", &x, &y); printf("sum of two numbers = %f\n", x+y); printf("average of two numbers = %f\n", (x+y)/2); } [ ] input data(x, y) = 100, 200 sum of two numbers = 30000000 average of two numbers = 15000000 11

getchar() putchar() getchar() putchar() char ch; ch = getchar(); putchar(ch); 12

getchar() putchar() [ 9-5] #include <stdioh> main() { char str; str = getchar(); putchar(str); putchar('\n'); putchar('a'); } [ ] d d A 13

getchar() putchar() [ 9-6] #include <stdioh> main() { char str; str = getchar(); while(str!= EOF) putchar(str); } [ ] example example ABCD EFG ABCD EFG 1234567 1234567 ^Z 14

gets() puts() gets() scanf() scanf() <Enter>, gets() <Entert> : + 1 NULL puts() NULL char name[10]; gets(name); puts(name); 15

gets() puts() [ 9-7] #include <stdioh> main() { char name[15], irum[15]; gets(name); scanf("%s", irum); printf("name = %s\n", name); printf("irum = %s\n", irum); } [ ] name = Hong Gil Dong irum = Hong 16

gets() puts() [ 9-8] #include <stdioh> main() { char ch[15]; gets(ch); printf("%s", ch); puts(ch); } [ ] Hong Gil DongHong Gil Dong 17

: "datain : "dataout : "mainc 3 18

19 fopen() fclose() fscanf() fprintf() fgetc() fputc() fgets() fputs()

fopen() fclose() fopen() filename mode FILE *fopen(filename, mode) constchar *filename; constchar *mode; / * filename : */ /* mode : */ 20

fopen() fclose() (mode) "r" "w" "a" "r+" ( ) "w+" "a+", "rb" "wb" "ab" "rb+" "wb+" "ab+", 21

fopen() fclose() [ 9-9] FILE *in, *out; in = fopen("examplein", "r"); out = fopen("exampleout", "w"); 22

fopen() fclose() fclose() :, int fclose(fptr); FILE *fptr; /* fptr : */ exit() 23

fopen() fclose() [ 9-10] #include <stdioh> main() { FILE *in, *out; } /* */ /* */ in = fopen("examplein", "r"); out = fopen("exampleout", "w"); fclose(in); fclose(out); /* */ 24

fprintf() fscant() fprintf() : printf() int fprintf(fptr, format, argument list); FILE *fptr; constchar *format; /* fptr : */ /* format : */ printf() fprintf(stdout, format, argument list); printf(format, argument list); 25

fprintf() fscant() fscanf() : scanf() int fscanf(fptr, format, argument list); FILE *fptr; const char *format; /* fptr : */ /* format : */ scanf() fscanf(stdin, format, argument list); scanf(format, argument list); 26

fprintf() fscant() [ 9-11] #include <stdioh> #include <stdlibh> main() { int kor, eng, mat, total; float average; FILE *in, *out; in = fopen("examplein", "r"); out = fopen("exampleout", "w"); if( in == NULL){ printf("file not found!!!"); exit(1); } 27

fprintf() fscant() [ 9-11] } fprintf(out, " *********** *********** \n"); fprintf(out, " \n\n"); while( fscanf(in, "%d %d %d", &kor, &eng, &mat)!= EOF ){ total = kor + eng + mat; average = total/3; fprintf(out, "%6d %8d %9d %82f\n", kor, eng,mat, total, average); } fclose(in); fclose(out); 28

fprintf() fscant() [ 9-11] [ ] *********** *********** 80 80 80 240 8000 90 95 85 270 9000 70 75 65 210 7000 90 75 100 265 8833 29

fgetc() fputc() fgetc() : int int fgetc(fptr); FILE *fptr; /* fptr : */ 30

fgetc() fputc() fputc() : int fputc(ch, fptr); FILE *fptr; 9-12 char ch; /* fptr : */ /* ch : */ fgetc() fputc() 31

fgetc() fputc() [ 9-12] #include <stdioh> #include <stdlibh> main(){ char ch; FILE *in, *out; in = fopen("examplec", "r"); if(in== NULL) { printf("file not found!!!\n") exit(1) } out = fopen("copyc", "w"); while((ch = fgetc(in))!= EOF) fputc(ch, out); [ ] fclose(in); examplec" fclose(out); copyc" } 32

fgets() fputs() fgets() : s ( \n ) EOF NULL char *fgets(s, n, fptr); char *s; int n; FILE *fptr; /* s : */ /* n : */ /* fptr : */ 33

fgets() fputs() fputs() : s int fputs(s, fptr); char *s; FILE *fptr; /* s : */ /* fptr : */ 34

fgets() fputs() [ 9-13] /* filename : inputc */ The limits in your life are the size of your ideas and your of determination degree #include <stdioh> main(){ char buf[256]; FILE *in, *out; int cnt = 0; in = fopen("inputc", "r"); out = fopen("outputc", "w"); while(fgets(buf, 256, in)!= NULL) { fputs(buf, out); ++cnt; } 35

fgets() fputs() [ 9-13] printf("this file includes %d lines\n", cnt); fclose(in); fclose(out); } [ ] This file includes 2 lines, "outputc" inputc" 36

fread() fwrite() fread() : n cnt buf int fread(buf, n, cnt, fptr); void *buf; int n; int cnt; FILE *fptr; /* buf : */ /* n : */ /* cnt : */ /* fptr : */ 37

fread() fwrite() fwrite() : int fwrite(buf, n, cnt, fptr); char *buf; int n; int cnt; FILE *fptr; /* buf : */ /* n : */ /* cnt : */ /* fptr : */ 38

fread() fwrite() [ 9-14] #include <stdioh> main() { FILE *fp; float f = 1005; if((fp = fopen("testc", "wb")) == NULL) { printf("cannot open file!\n"); return; } fwrite(&f, sizeof(float), 1, fp); fclose(fp); } 39

fseek() ftell() fseek() int fseek(fptr, offset, whence); FILE *fptr; long int offset; int whence; /* fptr : */ /* offset : */ /* whence : offset */ 40

fseek() ftell() Fseek() :, offset whence offset long whence 0 : (SEEK_SET) 1 : (SEEK_CUR) 2 : (SEEK_END) 41

fseek() ftell() ftell() long int ftell(fptr); FILE *fptr; /* fptr : */ 9-15,, 42

fseek() ftell() [ 9-15] #include <stdioh> main() { long int num, score, size = 16L; static char name[11], ch; FILE *out; out = fopen("randomdat", "w"); while(1){ printf("\n, ( 10 ), \n"); scanf("%1d %10s %3d", &num, &name, &score); fseek(out, (num-1)*size, 0); fprintf(out, "%3d %10s %3d", num, name, score); printf("? (Y/N)"); ch = getchar(); 43

fseek() ftell() [ 9-15] if((ch == 'Y' ch == 'y') continue; else break; } fclose(out); } [ ] 4 80 2 95 1 72 3 98 [ ] randomdat 1 72 2 95 3 98 4 80 44