{"id":348,"date":"2008-01-06T15:10:31","date_gmt":"2008-01-06T15:10:31","guid":{"rendered":"http:\/\/pchero21.com\/?p=348"},"modified":"2008-01-06T15:10:31","modified_gmt":"2008-01-06T15:10:31","slug":"%eb%a6%ac%eb%88%85%ec%8a%a4unix%ec%97%90%ec%84%9c-fflushstdin-%ec%82%ac%ec%9a%a9%ec%8b%9c-%eb%b0%9c%ec%83%9d%ed%95%98%eb%8a%94-%eb%ac%b8%ec%a0%9c%ec%a0%90","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=348","title":{"rendered":"\ub9ac\ub205\uc2a4(Unix)\uc5d0\uc11c fflush(stdin) \uc0ac\uc6a9\uc2dc \ubc1c\uc0dd\ud558\ub294 \ubb38\uc81c\uc810."},"content":{"rendered":"<p>&nbsp;scanf \ub85c \ubb38\uc790\uc5f4\uc744 \ubc1b\uace0 \ub098\uba74 \uacf5\ubc31\uc73c\ub85c \uad6c\ubd84\ub418\uc11c \ub0a8\uc740 \ubb38\uc790\ub4e4\uc774 \uc544\uc9c1 \ubc84\ud37c\uc5d0 \ub0a8\uc544 \uc788\uae30 \ub54c\ubb38\uc5d0&#8230;<\/p>\n<p><span style=\"font-weight: bold;\"><\/p>\n<blockquote><p>fflush(stdin);<\/p><\/blockquote>\n<p><\/span><\/p>\n<p>\uc744 \ud574\uc90c\uc73c\ub85c\uc368 \ubc84\ud37c\ub97c \ube44\uc6cc\uc8fc\ub294 \ud504\ub85c\uadf8\ub798\ubc0d \uae30\ubc95\uc774 \uc788\ub2e4.<\/p>\n<p>&nbsp;\ud558\uc9c0\ub9cc \uc774\uac83\uc740 \uc5c4\ubc00\ud788 \ub9d0\ud558\uba74 \ud2c0\ub9b0\uac83\uc774\ub2e4. \ub354 \uc815\ud655\ud788 \uc774\uc57c\uae30\ud558\uc790\uba74 VC \uc5d0\uc11c\ub9cc(\uc544\ub9c8\ub3c4..) \ub41c\ub2e4.<\/p>\n<p>&nbsp;\uc0ac\uc6a9\uc790\ub4e4\uc758 \ud3b8\uc758\ub97c \uc704\ud574 VC\uc5d0\uc11c \ud655\uc7a5\uc758 \uac1c\ub150\uc73c\ub85c \ub9cc\ub4e0\uac83\uc774\ub77c \uc0dd\uac01\ud558\uba74 \uc774\ud574\uac00 \uc26c\uc6b8 \uac83\uc774\ub2e4.<\/p>\n<p>&nbsp;\uadf8\ub807\ub2e4\uba74 \uc65c \uc774\uac83\uc774 \uc548\ub418\ub294 \uac83\uc77c\uae4c?<\/p>\n<p>C FAQ 12.26\uc744 \ubcf4\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \ub9d0\uc774 \ub098\uc628\ub2e4.<\/p>\n<blockquote><p><br style=\"font-weight: bold;\"><span style=\"font-weight: bold;\">C \uc5b8\uc5b4 \ud45c\uc900\uc5d0 \ub530\ub974\uba74,<br \/>\n        <\/span><tt style=\"font-weight: bold;\">fflush()<\/tt><span style=\"font-weight: bold;\">\ub294 output stream\uc5d0 \ub300\ud574\uc11c\ub9cc \ub3d9\uc791\ud569\ub2c8\ub2e4.<br \/>\n\t&#8220;flush&#8221;\ub77c\ub294 \uc815\uc758\uac00 buffering\ub41c \ubb38\uc790\ub4e4\uc744 \uc4f0\ub294 \uac83\uc744<br \/>\n\t\uc644\ub8cc\uc2dc\ud0a8\ub2e4\ub294<\/span><a style=\"font-weight: bold;\" name=\"tex2html66\" href=\"http:\/\/www.cinsk.org\/cfaqs\/html\/footnode.html#foot11622\"><sup>12.15<\/sup><\/a><span style=\"font-weight: bold;\">\t\uac83\uc774\ubbc0\ub85c \ubb38\uc790\ub97c \ucde8\uc18c\uc2dc\ud0a4\ub294 \uac83(discard)\uacfc\ub294 \uc544\ubb34\ub7f0 \uad00\uacc4\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.<br \/>\n\t\ub530\ub77c\uc11c<br \/>\n\t\uc785\ub825 \uc2a4\ud2b8\ub9bc\uc758 \uc785\ub825\uc744 \ubb34\uc2dc\ud558\ub294 \uae30\ub2a5\uacfc\ub294 \uc804\ud600 \uc0c1\uad00\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.<\/p>\n<p><\/span><\/p>\n<p style=\"font-weight: bold;\">\n\uc544\uc9c1 \uc77d\uc9c0 \uc54a\uc740 \ubb38\uc790(unread characters)\ub4e4\uc744 stdio input stream\uc5d0\uc11c<br \/>\n        \ubb34\uc2dc\ud558\ub294(discard) \ud45c\uc900 \ubc29\ubc95\uc740 \uc874\uc7ac\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<br \/>\n\t\uc5b4\ub5a4 \ucef4\ud30c\uc77c\ub7ec \ud68c\uc0ac\ub4e4\uc740 <tt>fflush(stdin)<\/tt>\uc774 \uc77d\uc9c0 \uc54a\uc740 \ubb38\uc790\ub4e4\uc744 \ucde8\uc18c\ud560 \uc218<br \/>\n\t\uc788\ub3c4\ub85d \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc81c\uacf5\ud558\uae30\ub3c4 \ud558\uc9c0\ub9cc, \uc774\uc2dd\uc131\uc774 \ub6f0\uc5b4\ub09c \ud504\ub85c\uadf8\ub7a8\uc744<br \/>\n\t\ub9cc\ub4e4\ub824\uba74 \uc808\ub300\ub85c \uc368\uc11c\ub294 \uc548\ub418\ub294 \uae30\ub2a5\uc785\ub2c8\ub2e4.<br \/>\n\t(\uc5b4\ub5a4 stdio \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 <tt>fpurge<\/tt>\ub098 <tt>fabort<\/tt>\ub97c \uac19\uc740 \uae30\ub2a5\uc73c\ub85c<br \/>\n\t\uc81c\uacf5\ud558\uae30\ub3c4 \ud558\uc9c0\ub9cc, \ub9c8\ucc2c\uac00\uc9c0\ub85c \ud45c\uc900\uc740 \uc544\ub2d9\ub2c8\ub2e4.)<br \/>\n\t\ub610\ud55c input buffer\ub97c flush\ud558\ub294 \uac83\uc774 \uaf2d \ud574\uacb0\ucc45\uc774\ub77c\uace0 \ud560 \uc218\ub3c4 \uc5c6\uc2b5\ub2c8\ub2e4.<br \/>\n\t\uc65c\ub0d0\ud558\uba74<br \/>\n\t\uc77c\ubc18\uc801\uc73c\ub85c \uc544\uc9c1 \uc77d\ud788\uc9c0 \uc54a\uc740 \uc785\ub825\uc740 OS-level input buffer\uc5d0<br \/>\n\t\uc874\uc7ac\ud558\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4. <\/p>\n<p style=\"font-weight: bold;\">\nInput\uc744 flush\ud560 \ubc29\ubc95\uc774 \ud544\uc694\ud558\ub2e4\uba74 (\uc9c8\ubb38 <a href=\"http:\/\/www.cinsk.org\/cfaqs\/html\/node21.html#19.1\"><br \/>\n<img alt=\"[*]\" src=\"http:\/\/www.cinsk.org\/cfaqs\/html\/crossref.png\" align=\"bottom\" border=\"1\"><\/a>19.1\uacfc <a href=\"http:\/\/www.cinsk.org\/cfaqs\/html\/node21.html#19.2\"><br \/>\n<img alt=\"[*]\" src=\"http:\/\/www.cinsk.org\/cfaqs\/html\/crossref.png\" align=\"bottom\" border=\"1\"><\/a>19.2\uc5d0 \ub098\uc628 \uac83\ucc98\ub7fc)<br \/>\n\t\uc2dc\uc2a4\ud15c \uc758\uc874\uc801\uc778 \ubc29\ubc95\uc744 \ucc3e\uc544\uc57c \ud560 \uac83\uc785\ub2c8\ub2e4.<br \/>\n\t\uac8c\ub2e4\uac00 \uc0ac\uc6a9\uc790\uac00 \ub9e4\uc6b0 \ube60\ub978 \uc18d\ub3c4\ub85c \uc785\ub825\ud558\uace0 \uc788\uace0, \uc5ec\ub7ec\ubd84\uc758 \ud504\ub85c\uadf8\ub7a8\uc774<br \/>\n\t\uadf8 \uc785\ub825\uc744 \ubb34\uc2dc\ud574\ubc84\ub9b4 \uc218 \uc788\ub2e4\ub294 \uac83\uc744 \uaf2d \uc5fc\ub450\uc5d0 \ub450\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<p style=\"font-weight: bold;\">\n\ub610\ub294 <code>n<\/code>\uc774 \ub098\uc624\uae30 \uc804\uae4c\uc9c0 \ubb38\uc790\ub97c \uc77d\uc5b4\uc11c \ubb34\uc2dc\ud558\uac70\ub098,<br \/>\n        curses\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \ub8e8\ud2f4\uc778 <tt>flushinp()<\/tt>\ub97c \uc4f0\uba74 \ub429\ub2c8\ub2e4.<br \/>\n        \ub367\ubd99\uc5ec \uc9c8\ubb38 <a href=\"http:\/\/www.cinsk.org\/cfaqs\/html\/node21.html#19.1\"><br \/>\n<img alt=\"[*]\" src=\"http:\/\/www.cinsk.org\/cfaqs\/html\/crossref.png\" align=\"bottom\" border=\"1\"><\/a>19.1, <a href=\"http:\/\/www.cinsk.org\/cfaqs\/html\/node21.html#19.2\"><br \/>\n<img alt=\"[*]\" src=\"http:\/\/www.cinsk.org\/cfaqs\/html\/crossref.png\" align=\"bottom\" border=\"1\"><\/a>19.2\ub3c4 \ucc38\uace0\ud558\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n<p>&nbsp;\uc989 \uc6d0\ub798 fflush() \ud568\uc218\ub294 output stream\uc5d0 \ub300\ud574\uc11c\ub9cc \ub3d9\uc791\ud558\ub294 \ud568\uc218\uc774\uae30 \ub54c\ubb38\uc5d0 input stream\uc5d0\ub294 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\ub294 \uac83\uc774\uace0, \ub610 \uadf8\ub7f0 \ud568\uc218\ub294 \uc874\uc7ac\ud558\uc9c0 \uc54a\ub294\ub2e4\ub294 \uac83\uc774\ub2e4.(\ubb3c\ub860 \ud45c\uc900\uc774\uc57c\uae30\uc774\ub2e4.)<\/p>\n<p>&nbsp;\uadf8\ub807\ub2e4\uba74 \uc5b4\ub5bb\uac8c \ud574\uc57c\ud560\uae4c?<\/p>\n<p><\/p>\n<fieldset class=\"geshi r2\">\n<legend><span class=\"g_lang\" style=\"color: rgb(170, 170, 170);\">(Language : c)<\/span><\/legend>\n<ol class=\"code\">\n<li class=\"li1\">\n<div class=\"de1\">scanf<span class=\"br0\">(<\/span><span class=\"st0\">&#8220;%d&#8221;<\/span>, &amp;a<span class=\"br0\">)<\/span>;<\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">getchar<span class=\"br0\">(<\/span><span class=\"br0\">)<\/span>;<\/div>\n<\/li>\n<\/ol>\n<\/fieldset>\n<p>&nbsp;\uc774\ub7f0 \uc2dd\uc73c\ub85c \ubc14\ub85c \uc544\ub798 \ub77c\uc778\uc5d0 \ub2e4\uc2dc \uc785\ub825\uc744 \ubc1b\ub294 \ud568\uc218\ub97c \ud638\ucd9c\uc5d0 \ubc84\ud37c\uc5d0 \ub0a8\uc544\uc788\ub294 \ubb38\uc790\ub4e4\uc744 \ube44\uc6cc\uc8fc\ub294 \uac83\ub3c4 \ud558\ub098\uc758 \uc88b\uc740 \ubcf4\uae30\uac00 \ub420 \uc218 \uc788\ub2e4.<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;scanf \ub85c \ubb38\uc790\uc5f4\uc744 \ubc1b\uace0 \ub098\uba74 \uacf5\ubc31\uc73c\ub85c \uad6c\ubd84\ub418\uc11c \ub0a8\uc740 \ubb38\uc790\ub4e4\uc774 \uc544\uc9c1 \ubc84\ud37c\uc5d0 \ub0a8\uc544 \uc788\uae30 \ub54c\ubb38\uc5d0&#8230; fflush(stdin); \uc744 \ud574\uc90c\uc73c\ub85c\uc368 \ubc84\ud37c\ub97c \ube44\uc6cc\uc8fc\ub294 \ud504\ub85c\uadf8\ub798\ubc0d \uae30\ubc95\uc774 \uc788\ub2e4. &nbsp;\ud558\uc9c0\ub9cc \uc774\uac83\uc740 \uc5c4\ubc00\ud788 \ub9d0\ud558\uba74 \ud2c0\ub9b0\uac83\uc774\ub2e4. \ub354 \uc815\ud655\ud788 \uc774\uc57c\uae30\ud558\uc790\uba74 VC \uc5d0\uc11c\ub9cc(\uc544\ub9c8\ub3c4..) \ub41c\ub2e4. &nbsp;\uc0ac\uc6a9\uc790\ub4e4\uc758 \ud3b8\uc758\ub97c \uc704\ud574 VC\uc5d0\uc11c \ud655\uc7a5\uc758 \uac1c\ub150\uc73c\ub85c \ub9cc\ub4e0\uac83\uc774\ub77c &hellip; <a href=\"http:\/\/pchero21.com\/?p=348\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40],"tags":[128,173,241,399,645,794],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/348"}],"collection":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=348"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/348\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}