{"id":97,"date":"2012-06-19T14:32:25","date_gmt":"2012-06-19T05:32:25","guid":{"rendered":"http:\/\/soundengine.jp\/wordpress\/tips\/?p=97"},"modified":"2014-02-06T23:42:41","modified_gmt":"2014-02-06T14:42:41","slug":"sscanf_s%e3%81%a7%e3%82%a8%e3%83%a9%e3%83%bc","status":"publish","type":"post","link":"https:\/\/soundengine.jp\/wordpress\/tips\/tutorial\/97\/","title":{"rendered":"sscanf_s\u3067\u30a8\u30e9\u30fc"},"content":{"rendered":"<h2 id=\"content_1_0\">_s  <a class=\"anchor_super\" id=\"a5829f59\" href=\"http:\/\/soundengine.jp\/backend\/?services%2Ftips%2F2007-02-05#a5829f59\" title=\"a5829f59\"> <\/a><\/h2>\n<p>VC++ 8.0\u3067CRT \u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f37\u5316\u306e\u305f\u3081\u306b\u4eca\u307e\u3067\u3042\u3063\u305fC\u95a2\u6570\u304c\u4e00\u90e8\u7f6e\u304d\u63db\u3048\u3089\u308c\u3066\u3044\u308b\u3002(\u3068\u306f\u3044\u3048\u6614\u306e\u3082\u4f7f\u3048\u308b\u306e\u3060\u304c\u3002)\u8abf\u3079\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u304c\u3001\u307b\u3068\u3093\u3069\u306e\u7f6e\u304d\u63db\u3048\u3089\u308c\u305f\u95a2\u6570\u306f\u3001\u5143\u306e\u95a2\u6570\u540d\u306b\u300c_s\u300d\u306e\u30dd\u30b9\u30c8\u30d5\u30a3\u30c3\u30af\u30b9\u304c\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u3002\u5358\u306b\u95a2\u6570\u540d\u304c\u5909\u308f\u3063\u305f\u3060\u3051\u3067\u306a\u304f\u5f15\u6570\u304c\u3044\u3058\u3089\u308c\u3066\u3044\u308b\u306e\u3082\u591a\u3044\u306e\u3067\u6ce8\u610f\u3057\u3066\u4f7f\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n<p><!--more--><\/p>\n<div class=\"jumpmenu\">\n<\/div>\n<h2 id=\"content_1_1\">sscanf_s  <a class=\"anchor_super\" id=\"d5e8f270\" href=\"http:\/\/soundengine.jp\/backend\/?services%2Ftips%2F2007-02-05#d5e8f270\" title=\"d5e8f270\"> <\/a><\/h2>\n<p>sscanf\u306f\u3001\u6587\u5b57\u5217\u3092\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5f93\u3063\u3066\u30d1\u30fc\u30b9\u3059\u308b\u95a2\u6570\u3067\u3042\u308b\u304c\u3001CRT\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f37\u5316\u7248\u3067\u306fsscanf_s\u3092\u4f7f\u3046(\u4f3c\u305f\u3082\u306e\u306b_sscanf_s_l\u3001swscanf_s\u3001_swscanf_s_l\u306a\u3069)<\/p>\n<p>\u3053\u3053\u3067\u5358\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u4e2d\u306esscanf\u3092sscanf_s\u306b\u7f6e\u304d\u63db\u3048\u305f\u3060\u3051\u3067\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u6ce8\u610f\u3057\u3066\u6b32\u3057\u3044\u3002<a href=\"http:\/\/msdn2.microsoft.com\/ja-jp\/library\/t6z7bya3%28VS.80%29.aspx\" rel=\"nofollow\">MSDN<\/a>\u306b\u3082\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u304c\u3001<\/p>\n<blockquote>\n<p class=\"quotation\">\u578b\u30d5\u30a3\u30fc\u30eb\u30c9\u6587\u5b57 c\u3001C\u3001s\u3001S \u3001\u304a\u3088\u3073 [ \u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u30d0\u30c3\u30d5\u30a1 \u30b5\u30a4\u30ba\u306e\u30d1\u30e9\u30e1\u30fc\u30bf sizeOfBuffer \u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<\/blockquote>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3042\u308b\u3002\u3053\u308c\u306f\u3001\u3064\u307e\u308a\u6587\u5b57\u306e\u30d1\u30fc\u30b9\u3092\u3059\u308b\u5834\u5408\u306b\u305d\u306e\u7d50\u679c\u3092\u53d7\u3051\u53d6\u308b\u30d0\u30c3\u30d5\u30a1\u306e\u30b5\u30a4\u30ba\u3092\u5f15\u6570\u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3042\u308b\u3002<\/p>\n<p>\u4eca\u307e\u3067\u3001<\/p>\n<pre>char src[] = \"hoge\";\r\ncahr dst[ 16 ];\r\nsscanf( src, \"%s\", dst );<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u52d5\u3044\u3066\u3044\u305f\u3082\u306e\u306f\u3001<\/p>\n<pre>char src[] = \"hoge\";\r\nchar dst[ 16 ];\r\nsscanf_s( src, \"%s\", dst, sizeof( dst ) );<\/pre>\n<p>\u3068\u3044\u3046\u3088\u3046\u306b\u3055\u3089\u306b\u30d0\u30c3\u30d5\u30a1\u30b5\u30a4\u30ba\u306e\u5f15\u6570\u3082\u8ffd\u52a0\u3057\u306a\u304f\u3066\u306f\u306a\u3089\u306a\u3044\u3002\u3082\u3057\u3053\u306e\u3088\u3046\u306a\u30b5\u30a4\u30ba\u3092\u8a18\u8ff0\u3057\u306a\u304b\u3063\u305f\u5834\u5408\u3001\u5358\u306b\u8aad\u307f\u8fbc\u3081\u306a\u304b\u3063\u305f\u3068\u3044\u3046\u3053\u3068\u3067\u5e30\u308a\u50240\u304c\u5e30\u308b\u304b\u3001\u305f\u3068\u3048\u3070\u6b21\u306e\u3088\u3046\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u6307\u5b9a\u306e\u5834\u5408<\/p>\n<pre>char src[] = \"hoge 1\";\r\nchar dst1[ 16 ];\r\nint  dst2;\r\nsscanf_s( src, \"%s %d\", dst1, &amp;dst2 );<\/pre>\n<p>\u3057\u3070\u3089\u304f\u3060\u3093\u307e\u308a\u3057\u305f\u3042\u3068\u3001<\/p>\n<blockquote>\n<p class=\"quotation\">xxxxxxxx.exe \u306e 0x7c9778ae \u3067\u30cf\u30f3\u30c9\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f: 0xC0000005: \u5834\u6240 0x00030fe0 \u306b\u66f8\u304d\u8fbc\u307f\u4e2d\u306b\u30a2\u30af\u30bb\u30b9\u9055\u53cd\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<\/blockquote>\n<p>\u3053\u3093\u306a\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3046\u3002\u3053\u308c\u306f\u3001dst1\u306e\u30b5\u30a4\u30ba\u304c&amp;dst2\u3068\u3044\u3046\u30dd\u30a4\u30f3\u30bf\u306e\u5024\u3067\u3042\u308b\u3068\u3055\u308c\u3066\u3057\u307e\u3046\u305f\u3081\u3060\u3068\u8003\u3048\u3089\u308c\u308b\u3002\u753b\u9762\u4e0b\u306e\u51fa\u529b\u306b\u306f\u3001<\/p>\n<blockquote>\n<p class=\"quotation\">xxxxxxxx.exe \u306e 0xfdfdfdfd \u3067\u521d\u56de\u306e\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f: 0xC0000005: \u5834\u6240 0xfdfdfdfd \u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306b\u30a2\u30af\u30bb\u30b9\u9055\u53cd\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<\/blockquote>\n<p>\u3053\u306e\u3088\u3046\u306a\u5185\u5bb9\u306e\u30c7\u30d0\u30c3\u30b0\u51fa\u529b\u304c\u5927\u91cf\u306b\u66f8\u304b\u308c\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>_s VC++ 8.0\u3067CRT \u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f37\u5316\u306e\u305f\u3081\u306b\u4eca\u307e\u3067\u3042\u3063\u305fC\u95a2\u6570\u304c\u4e00 &hellip; <a href=\"https:\/\/soundengine.jp\/wordpress\/tips\/tutorial\/97\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"_links":{"self":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":4,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":3377,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts\/97\/revisions\/3377"}],"wp:attachment":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}