{"id":4938,"date":"2012-10-09T22:29:38","date_gmt":"2012-10-09T13:29:38","guid":{"rendered":"http:\/\/nanoappli.com\/blog\/?p=4938"},"modified":"2012-10-09T22:29:38","modified_gmt":"2012-10-09T13:29:38","slug":"cstreamreader%e3%81%aeread%e3%81%8cchar%e3%81%a7%e3%81%af%e3%81%aa%e3%81%8fint%e3%82%92%e8%bf%94%e3%81%99%e7%90%86%e7%94%b1","status":"publish","type":"post","link":"http:\/\/nanoappli.com\/blog\/archives\/4938","title":{"rendered":"[C#]StreamReader\u306eRead()\u304cchar\u3067\u306f\u306a\u304fint\u3092\u8fd4\u3059\u7406\u7531"},"content":{"rendered":"<p>\n\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089\u30c7\u30fc\u30bf\u30921\u6587\u5b57\u8aad\u307f\u8fbc\u3080\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066Read()\u3068\u3044\u3046\u3082\u306e\u304c\u6709\u308a\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f&#8221;1\u6587\u5b57&#8221;\u8aad\u307f\u8fbc\u3080\u306e\u3060\u304b\u3089\u623b\u308a\u5024\u306fchar\u3067\u3088\u3044\u306f\u305a\u306a\u306e\u3067\u3059\u304c\u3001\u306a\u305c\u304bint\u578b\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n<br \/>\n\u306a\u305cint\u3092\u8fd4\u3059\u3088\u3046\u306a\u4ed5\u69d8\u3068\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b?<br \/>\n<br \/>\n<br \/>\n\u305d\u308c\u306f\u3001Read()\u30e1\u30bd\u30c3\u30c9\u306e\u623b\u308a\u5024\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u53d6\u5f97\u3057\u305f\u6587\u5b57\u306b\u52a0\u3048\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u7d42\u7aef(EOF)\u3092\u8fd4\u3057\u3066\u304f\u308b\u304b\u3089\u3067\u3059\u3002EOF\u3068\u3044\u3046\u306e\u306f\u3001\u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u5f8c\u306b\u9054\u3057\u3066\u3057\u307e\u3044\u3001\u305d\u308c\u4ee5\u4e0a\u8aad\u3080\u3079\u304d\u30c7\u30fc\u30bf\u304c\u7121\u3044\u72b6\u6cc1\u3067\u3059\u3002<br \/>\n(\u3061\u306a\u307f\u306b\u3001EOF\u306b\u9054\u3057\u3066\u3044\u308b\u72b6\u614b\u3067\u3055\u3089\u306bRead()\u3092\u30b3\u30fc\u30eb\u3057\u3066\u3082-1\u304c\u8fd4\u3055\u308c\u7d9a\u3051\u307e\u3059)<br \/>\n<br \/>\nC#\u306echar\u306f2byte\u306a\u306e\u3067\u300165536\u7a2e\u985e\u306e\u6587\u5b57\u304c\u8868\u73fe\u3067\u304d\u307e\u3059\u3002<br \/>\n\u4e00\u65b9\u3001Read\u306e\u623b\u308a\u5024\u3068\u3057\u3066\u8fd4\u3055\u308c\u308b\u30c7\u30fc\u30bf\u306f\u300165536\u7a2e\u985e\u306e\u6587\u5b57\uff0bEOF\u306e65537\u7a2e\u985e\u3067\u3059\u3002<br \/>\n<br \/>\n\u306a\u306e\u3067\u3001char\u578b\u3060\u306865537\u30d1\u30bf\u30fc\u30f3\u306e\u30c7\u30fc\u30bf\u3092\u8868\u73fe\u3067\u304d\u305a\u3001\u3088\u308a\u8868\u73fe\u7bc4\u56f2\u304c\u591a\u3044int\u578b\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3067\u3059\u3002Read()\u306fEOF\u4ee5\u5916\u306e\u5834\u5408\u306f\u6b63\u306e\u5024\u3001EOF\u306e\u5834\u5408\u306f-1\u3092\u8fd4\u3059\u3068\u3044\u3046\u4ed5\u69d8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n<br \/>\nRead()\u30e1\u30bd\u30c3\u30c9\u3067\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u306f\u3001\u5f8c\u7d9a\u306e\u51e6\u7406\u3067\u306fchar\u578b\u306e\u5909\u6570\u306b\u5165\u3063\u3066\u3044\u308b\u3068\u4f55\u304b\u3068\u4fbf\u5229\u306a\u5834\u5408\u304c\u591a\u3044\u3067\u3059\u304c\u3001\u4e0a\u8a18\u306e\u7406\u7531\u306b\u3088\u308a\u3001EOF\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3063\u305f\u5f8c\u306a\u3089\u30ad\u30e3\u30b9\u30c8\u3057\u3066\u3057\u307e\u3063\u3066OK\u3067\u3059\u3002<br \/>\n<pre lang=\"csharp\">\nStreamReader reader = ...;\n\nint data = reader.Read();\nif ( data == -1 ) {\n\t\/\/EOF\u304c\u6765\u305f\u6642\u306e\u51e6\u7406\n}\n\n\/\/ \u3053\u3053\u3067char\u578b\u306b\u30ad\u30e3\u30b9\u30c8\u3059\u308b\nchar ch = (char)data;\n<\/pre>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089\u30c7\u30fc\u30bf\u30921\u6587\u5b57\u8aad\u307f\u8fbc\u3080\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066Read()\u3068\u3044\u3046\u3082\u306e\u304c\u6709\u308a\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f&#8221;1\u6587\u5b57&#8221;\u8aad\u307f\u8fbc\u3080\u306e\u3060\u304b\u3089\u623b\u308a\u5024\u306fchar\u3067\u3088\u3044\u306f\u305a\u306a\u306e\u3067\u3059\u304c\u3001\u306a\u305c\u304bint\u578b\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002 \u306a\u305cint\u3092\u8fd4\u3059\u3088\u3046\u306a\u4ed5\u69d8\u3068\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b? \u305d\u308c\u306f\u3001Read()\u30e1\u30bd\u30c3\u30c9\u306e\u623b\u308a\u5024\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u53d6\u5f97\u3057\u305f\u6587\u5b57\u306b\u52a0\u3048\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u7d42\u7aef(EOF)\u3092\u8fd4\u3057\u3066\u304f\u308b\u304b\u3089\u3067\u3059\u3002EOF\u3068\u3044\u3046\u306e\u306f\u3001\u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u5f8c\u306b\u9054\u3057\u3066\u3057\u307e\u3044\u3001\u305d\u308c\u4ee5\u4e0a\u8aad\u3080\u3079\u304d\u30c7\u30fc\u30bf\u304c\u7121\u3044\u72b6\u6cc1\u3067\u3059\u3002 (\u3061\u306a\u307f\u306b\u3001EOF\u306b\u9054\u3057\u3066\u3044\u308b\u72b6\u614b\u3067\u3055\u3089\u306bRead()\u3092\u30b3\u30fc\u30eb\u3057\u3066\u3082-1\u304c\u8fd4\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[5],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":3539,"url":"http:\/\/nanoappli.com\/blog\/archives\/3539","url_meta":{"origin":4938,"position":0},"title":"[C\u8a00\u8a9e\u5165\u9580]\u5909\u6570\u304c\u4fdd\u6301\u3067\u304d\u308b\u5024\u306e\u7bc4\u56f2\u306b\u3064\u3044\u3066","date":"2012\u5e747\u670810\u65e5","format":false,"excerpt":"\u5909\u6570\u306e\u5ba3\u8a00 \u4eca\u56de\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u3001\"int result\"\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u6574\u6570\u578b\u306e\u5909\u6570result\u3092\u5b9a\u7fa9\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3848,"url":"http:\/\/nanoappli.com\/blog\/archives\/3848","url_meta":{"origin":4938,"position":1},"title":"[C\u8a00\u8a9e\u5165\u9580]\u30dd\u30a4\u30f3\u30bf\u3092\u7406\u89e3\u3059\u308b \u305d\u306e1:\u30e1\u30e2\u30ea\u3068\u30dd\u30a4\u30f3\u30bf\u5909\u6570\u5165\u9580","date":"2012\u5e748\u67084\u65e5","format":false,"excerpt":"\u4eca\u56de\u306e\u8aac\u660e\u306f\u30dd\u30a4\u30f3\u30bf\u5909\u6570\u3067\u3059\u3002 \u30dd\u30a4\u30f3\u30bf\u5909\u6570\u306f\u3001\u7279\u306b\u96e3\u3057\u3044\u3068\u3044\u3046\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001C\u8a00\u8a9e\u3067\u306e\u8868\u8a18\u2026","rel":"","context":"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/nanoappli.com\/blog\/wp-content\/uploads\/2012\/08\/20120804_05.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4476,"url":"http:\/\/nanoappli.com\/blog\/archives\/4476","url_meta":{"origin":4938,"position":2},"title":"HEW\u304c\u81ea\u52d5\u751f\u6210\u3057\u305fiodefine.h\u306e\u8aad\u307f\u65b9(for C\u8a00\u8a9e)","date":"2012\u5e749\u670813\u65e5","format":false,"excerpt":"H8\u30de\u30a4\u30b3\u30f3\u3067I\/O\u64cd\u4f5c\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u3001H8\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u6307\u5b9a\u3055\u308c\u305f\u756a\u5730\u306b\u5bfe\u3057\u3066\u3001\u30e1\u30e2\u30ea\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6347,"url":"http:\/\/nanoappli.com\/blog\/archives\/6347","url_meta":{"origin":4938,"position":3},"title":"[C#]\u6587\u5b57\u5217\u3092MD5\u30cf\u30c3\u30b7\u30e5\u5316\u3057,\u6587\u5b57\u5217\u3068\u3057\u3066\u8fd4\u3059\u30e1\u30bd\u30c3\u30c9","date":"2013\u5e746\u670824\u65e5","format":false,"excerpt":"C#\u3067\u306f\u3001MD5\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u3001System.Security.Cryptography.MD5\u30af\u30e9\u30b9\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3307,"url":"http:\/\/nanoappli.com\/blog\/archives\/3307","url_meta":{"origin":4938,"position":4},"title":"[PIC]MPLAB\u3067\u4f5c\u6210\u3055\u308c\u305fhex\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u89e3\u6790\u3059\u308b","date":"2012\u5e746\u670827\u65e5","format":false,"excerpt":"MPLAB\u3067\u958b\u767a\u3092\u884c\u3044\u3001\u30b3\u30f3\u30d1\u30a4\u30eb(or\u30a2\u30bb\u30f3\u30d6\u30eb)\u3092\u884c\u3046\u3068*.hex\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002 PI\u2026","rel":"","context":"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/nanoappli.com\/blog\/wp-content\/uploads\/2012\/06\/20120626_32-308x300.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3655,"url":"http:\/\/nanoappli.com\/blog\/archives\/3655","url_meta":{"origin":4938,"position":5},"title":"C#\u3067intel\u306ehex\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u89e3\u6790\u3059\u308b","date":"2012\u5e747\u670821\u65e5","format":false,"excerpt":"C#\u3067intel\u306ehex\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u89e3\u6790\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u305f\u306e\u3067,\u516c\u958b\u3057\u3066\u304a\u304d\u307e\u3059\u3002 he\u2026","rel":"","context":"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts\/4938"}],"collection":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/comments?post=4938"}],"version-history":[{"count":8,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts\/4938\/revisions"}],"predecessor-version":[{"id":4946,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/posts\/4938\/revisions\/4946"}],"wp:attachment":[{"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/media?parent=4938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/categories?post=4938"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nanoappli.com\/blog\/wp-json\/wp\/v2\/tags?post=4938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}