{"id":7243,"date":"2015-07-02T00:03:16","date_gmt":"2015-07-01T06:03:16","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=7243"},"modified":"2015-07-02T13:34:22","modified_gmt":"2015-07-02T04:34:22","slug":"windows-%e3%82%b9%e3%83%88%e3%82%a2%e3%82%a2%e3%83%97%e3%83%aa%e3%81%8b%e3%82%89-c%e8%a8%80%e8%aa%9e%e3%81%ae-fopen-%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%83%ad%e3%83%bc%e3%82%ab%e3%83%ab","status":"publish","type":"post","link":"https:\/\/www.moonmile.net\/blog\/archives\/7243","title":{"rendered":"Windows \u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u304b\u3089 C\u8a00\u8a9e\u306e fopen \u3092\u5229\u7528\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u65b9\u6cd5"},"content":{"rendered":"<p>\u4e45\u3057\u632f\u308a\u306eC\u8a00\u8a9e\u3067\u3059\u304c\u3001\u3056\u3056\u3063\u3068\u66f8\u304d\u4e0b\u3057\u307e\u3059\u3002\u3068\u3042\u308b\u3068\u3053\u308d\u3067\u8abf\u3079\u59cb\u3081\u3066\u3061\u3087\u3063\u3068\u7a81\u3063\u8fbc\u3093\u3060\u3068\u3053\u308d\u3067\u3001\u672c\u5f53\u306b\u3067\u304d\u308b\u306e\u304b\uff1f\u3063\u3066\u306e\u3092\u8abf\u67fb\u3057\u3066\u3044\u308b\u9014\u4e2d\u3067\u3059\u3002\u3044\u3084\u3001\u6b63\u76f4\u306b\u8a00\u3046\u3068\u76ee\u7684\u3092\u9054\u3059\u308b\u624b\u6bb5\u3068\u3057\u3066\u306f\u7d50\u69cb\u5371\u3046\u3044\u306e\u3067\u3001\u307e\u3068\u3082\u306b C# \u3067\u66f8\u304d\u76f4\u3059\u306a\u308a\u5225\u306a\u65b9\u6cd5\u3092\u53d6\u3063\u305f\u307b\u3046\u304c\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u6700\u521d\u306e\u76ee\u8ad6\u898b\u304c\u9054\u6210\u3067\u304d\u308b\u306e\u304b\u3092\u78ba\u8a8d\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3002<\/p>\n<h2>C\/C++\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u305d\u306e\u307e\u307e\u4f7f\u3046<\/h2>\n<p>\u3068\u3042\u308bC\u8a00\u8a9e\u3067\u4f5c\u3063\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u306a\u3089\u3070\u3001\u305d\u306e\u307e\u307e\u9759\u7684\u30ea\u30f3\u30af\u3092\u3059\u308b\u304bDLL\u547c\u3073\u51fa\u3057\u3092\u3059\u308c\u3070\u826f\u3044\u8a33\u3067\u3001OpenCV\u3068\u304b\u305d\u306e\u624b\u306eC++\u7d61\u307f\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u5074\u3067\u52d5\u304b\u3057\u307e\u3059\u3002\u305d\u308c\u3092.NET\u3067\u5305\u3080\u304b\u3001iOS\u5185\u3067\u30ea\u30f3\u30af\u3055\u305b\u3066\u52d5\u304b\u3059\u304b\u3001Java\u304b\u3089JNI\u3092\u901a\u3057\u3066\u52d5\u304b\u3059\u304b\u306f\u8272\u3005\u3068\u52d5\u4f5c\u74b0\u5883\u306b\u3088\u308a\u65b9\u6cd5\u304c\u9055\u3046\u306e\u3067\u3059\u304c\u3001Windows \u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u4e0a\u3067\u52d5\u304b\u305d\u3046\u3068\u3059\u308b\u3068\u7d50\u69cb\u306a\u624b\u9593\u3067\u3059\u3002<\/p>\n<p>\u3072\u3068\u3064\u306e\u65b9\u6cd5\u3068\u3057\u3066\u306f\u3001C++\/CX\u3067\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u3092\u4f7f\u3063\u3066\u3001C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30ea\u30f3\u30af\u3055\u305b\u307e\u3059\u3002C++\/CX\u306e\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u304b\u3089\u306f\u3001stlen\u3068\u304bstd:string\u3068\u304b\u306e\u6a19\u6e96\u7684\u306a\u95a2\u6570\u306f\u5927\u65b9\u547c\u3073\u51fa\u305b\u307e\u3059\u3002\u5927\u65b9\u547c\u3073\u51fa\u305b\u307e\u3059\u3068\u3044\u3046\u306e\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u7cfb\u3060\u3068\u304b\u30b7\u30b9\u30c6\u30e0\u7cfb\u306e\u95a2\u6570\u3068\u304b\u306f\u96e3\u3057\u305d\u3046\u3067\u3001\u74b0\u5883\u5909\u6570\u3092\u547c\u3073\u51fa\u3059getenv\u95a2\u6570\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u9006\u306b\u8a00\u3048\u3070\u3001\u30ed\u30b8\u30c3\u30af\u7cfb\u306e\u3082\u306e\u3067\u3042\u308c\u3070\u305d\u306e\u307e\u307e\u52d5\u304f\u3060\u308d\u3046\u3068\u3044\u3046\u76ee\u7b97\u304c\u7acb\u3061\u307e\u3059\u3002\u305d\u3046\u306a\u308b\u3068\u3001\u65e2\u5b58\u306eC\u8a00\u8a9e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u305d\u306e\u307e\u307e\u79fb\u690d\u3067\u304d\u308b\u308f\u3051\u3067\u3001\u7279\u306bLinux\u7cfb\u306e\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u305d\u306e\u307e\u307e\u30d3\u30eb\u30c9\u3057\u3066\u6301\u3063\u3066\u304f\u308b\u3053\u3068\u3082\u53ef\u80fd\u3060\u308d\u3046\u3001\u3068\u601d\u308f\u308c\u307e\u3059\u3002<\/p>\n<p>\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092C++\/CX\u3067\u4f5c\u308b\u306e\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u5df7\u306e\u30b5\u30f3\u30d7\u30eb\u7684\u306b\u306fC#\u304c\u5727\u5012\u7684\u306b\u591a\u3044\u306e\u3068\uff08\u9006\u306b\u8a00\u3048\u3070C++\/CX\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u975e\u5e38\u306b\u5c11\u306a\u3044\uff09\u3001async\/await\u306e\u975e\u540c\u671f\u51e6\u7406\u304c\u7d50\u69cb\u3084\u308a\u3065\u3089\u3044\u306e\u3067 C++\/CX \u3067\u30d5\u30eb\u306e\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306f\u4f5c\u308a\u305f\u304f\u306a\u3044\u3068\u3053\u308d\u3067\u3059\u3002\u305d\u306e\u3088\u3046\u306a\u5834\u5408\u306f\u3001C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u3046\u307e\u304f\u30de\u30c3\u30d4\u30f3\u30b0\u3059\u308bC++\/CX\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u3063\u3066\u304a\u3044\u3066\u3001C#\u5074\u306b\u63d0\u4f9b\u3055\u305b\u307e\u3059\u3002\u30ed\u30b8\u30c3\u30af\u90e8\u5206\u306f\u5168\u4f53\u306e\u4e00\u90e8\u5206\u306b\u306a\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001\u5927\u65b9\u306e\u3068\u3053\u308d\u306f C# \u3067\u66f8\u304d\u3001\u5c0f\u96e3\u3057\u304f\u3066 Linux \u7b49\u304b\u3089\u79fb\u690d\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u3068\u3053\u308d\u3092 C++\/CX \u3067\u30d6\u30ea\u30c3\u30b8\u3092\u66f8\u304f\u3068\u3044\u3046\u5177\u5408\u306b\u306a\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u5927\u4f53\u3053\u308c\u3067\u884c\u3051\u305d\u3046\u306a\u6c17\u304c\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3075\u3068\u3001\u79fb\u690d\u304c\u3067\u304d\u308b\u304b\u306a\uff1f\u3068\u3044\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u773a\u3081\u3066\u307f\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u7cfb\u306e\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>fopen\u95a2\u6570\u306f\u6271\u3048\u308b\u306e\u304b\uff1f<\/h2>\n<p>\u6700\u521d\u306e\u8a2d\u5b9a\u3084\u3089\u30c7\u30fc\u30bf\u3084\u3089\u3092\u8aad\u307f\u8fbc\u3080\u5834\u5408\u306b\u306f\u3001C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306ffopen\u95a2\u6570\u304c\u666e\u901a\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u3042\u3061\u3053\u3061\u3067\u3001fread\/fwrite\u95a2\u6570\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3092\u3001WinRT \u306e StorageFile \u306b\u76f4\u3059\u306e\u306f\u7d50\u69cb\u624b\u9593\u3067\u3059&#8230;\u3068\u8a00\u3044\u307e\u3059\u304b\u3001\u307b\u307c\u4e0d\u53ef\u80fd\u3067\u3059\u3002StorageFile \u30af\u30e9\u30b9\u306e\u307b\u3046\u306f\u3001\u975e\u540c\u671f\u51e6\u7406\u304c\u5165\u3063\u3066\u3057\u307e\u3063\u3066\u3001\u3069\u3046\u306b\u3082\u3053\u3046\u306b\u3082\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\u90e8\u5206\u306e\u66f8\u304d\u63db\u3048\u304c\u5fc5\u9808\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u90e8\u5206\u7684\u306b fread \u95a2\u6570\u547c\u3073\u51fa\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3042\u308c\u3070\u3001\u306a\u3093\u3068\u304b\u306a\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u3042\u305f\u308a\u304c\u6df7\u5728\u3057\u3066\u6563\u3089\u3070\u3063\u3066\u3044\u3057\u307e\u3063\u3066\u3044\u308b\u3068\u4fee\u6b63\u3059\u308b\u306e\u306f\u3061\u3087\u3063\u3068\u304a\u624b\u4e0a\u3052\u72b6\u614b\u3067\u3059\u306d\u3002\u3044\u3061\u304b\u3089\u4f5c\u308b\u76f4\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u3067\u306f\uff1f\u3068\u601d\u3046\u304f\u3089\u3044\u3067\u3001\u3060\u304b\u3089\u3053\u305d\u3001\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e\u307b\u3046\u306e\u79fb\u690d\u304c\u9032\u307e\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>C# \u3067\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u3092\u3057\u3066\u3044\u308b\u3068\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u76f4\u63a5\u6271\u3046\u3053\u3068\u306f\u5c11\u306a\u3044\u306e\u3067\u3001\u3058\u3083\u3042\u3001C\u8a00\u8a9e\u3067\u4f7f\u3046 fopen \u95a2\u6570\u304c\u4f7f\u3048\u308b\u306e\u304b\uff1f\u3068\u3044\u3046\u7591\u554f\u304c\u767a\u751f\u3057\u307e\u3059\u3002\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e C#\/VB \u306e\u307b\u3046\u3067\u306f System.IO.File \u30af\u30e9\u30b9\u304c\u7121\u304f\u306a\u3063\u3066\u3044\u3066\u76f4\u63a5\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u3066\u4efb\u610f\u306a\u3068\u3053\u308d\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u3057\u304b\u3057\u3001\u300c\u4efb\u610f\u306a\u3068\u3053\u308d\u300d\u4ee5\u5916\u306f\u3067\u304d\u308b\u308f\u3051\u3067\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\uff08Assets\u306e\u4e0b\u3068\u304b\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5148\u306e\u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\u3068\u304b\uff09\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u30d5\u30a9\u30eb\u30c0\u3068\u304b\u306f\u30a2\u30af\u30bb\u30b9\u304c\u53ef\u80fd\u3067\u3059\u3001\u4ee5\u524d\u3001\u76f4\u63a5 C++\/CX \u3067\u300c\u4efb\u610f\u306a\u30d5\u30a1\u30a4\u30eb\u300d\u3092\u30aa\u30fc\u30d7\u30f3\u3057\u3088\u3046\u3068\u601d\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u99c4\u76ee\u3060\u3063\u305f\u306e\u3067\u3042\u3063\u3055\u308a\u3042\u304d\u3089\u3081\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u3082\u3046\u3061\u3087\u3063\u3068\u7a81\u3063\u8fbc\u3093\u3067\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001fopen \u7cfb\u306e\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u3082 C#\/VB \u3068\u540c\u3058\u3088\u3046\u306b\u3001\u30a2\u30d7\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0\u5185\u3084\u30a2\u30d7\u30ea\u30c7\u30fc\u30bf\u306e\u30d5\u30a9\u30eb\u30c0\u3078\u306f\u30a2\u30af\u30bb\u30b9\u304c\u3067\u304d\u307e\u3059\u3002fget\/fread \u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u306a\u308a\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u304a\u305d\u3089\u304f\u3001\u30a2\u30d7\u30ea\u30c7\u30fc\u30bf\u9818\u57df\u3067\u3042\u308c\u3070 fwrite \u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3057\u3087\u3046\u3002\u3053\u306e\u8fba\u308a\u306f\u3001\u3082\u3046\u3061\u3087\u3063\u3068\u5f8c\u3067\u8abf\u3079\u3066\u3044\u304d\u307e\u3059\u3002\u3072\u3068\u307e\u305a\u3001\u3044\u307e\u3084\u308a\u305f\u3044\u3053\u3068\u306f\u3001\u6700\u521d\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981\u3060\u3063\u305f\u306e\u3067\u3001fopen\/fread \u306e\u7d44\u307f\u5408\u308f\u305b\u3060\u3051\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306e fopen \u304c\u6709\u52b9\u306b\u50cd\u304f<\/h2>\n<p>\u76ee\u6a19\u3068\u3057\u3066\u306f\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u7cfb\u306e C\/C++ \u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u305d\u306e\u307e\u307e\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u3067\u30ea\u30f3\u30af\u3092\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>NuGet Gallery | Xamarin.Tesseract 0.2.4<br \/>\n<a href=\"http:\/\/www.nuget.org\/packages\/Xamarin.Tesseract\/\">http:\/\/www.nuget.org\/packages\/Xamarin.Tesseract\/<\/a><\/p>\n<p>\u5b9f\u306f\u3061\u3087\u3046\u3069\u8abf\u3079\u3066\u3044\u305f\u3068\u304d\u306b\u3001Xamarin \u4e0a\u3067\u52d5\u304f Tesseract-OCR \u3092\u898b\u3064\u3051\u307e\u3057\u305f\u3002\u6298\u3057\u3082\u4f5c\u308a\u59cb\u3081\u305f\u3070\u304b\u308a\u3067\u3001\u306a\u3093\u3068\u3044\u3044\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3057\u3087\u3046\u3001\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002\u4e2d\u306e\u30bd\u30fc\u30b9\u3092\u898b\u308b\u3068\u89e3\u308b\u306e\u3067\u3059\u304c\u3001Xamarin.Android\/iOS \u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u305d\u308c\u305e\u308c\u306e Tesseract \u306e\u30d0\u30a4\u30ca\u30ea\u5f62\u5f0f\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u542b\u307e\u308c\u307e\u3059\u3002\u306a\u308b\u307b\u3069\u3002Android \u306e\u5834\u5408\u306f\u3001\u305d\u306e\u307e\u307e JNI \u3067 wrap \u3055\u305b\u308c\u3070\u3088\u3044\u3057\u3001iOS \u306e\u5834\u5408\u306b\u306f Objective-C \u304b\u3089\u547c\u3073\u51fa\u305b\u308b\u308f\u3051\u3067\u3059\u304b\u3089\u3001\u305d\u308c\u3092 C# \u304b\u3089\u547c\u3073\u51fa\u305b\u308b\u5f62\u5f0f\u306b\u5909\u3048\u308c\u3070\u3088\u3044\u308f\u3051\u3067\u3059\u3002\u4e2d\u8eab\u306e\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u7cfb\u3082\u3001Android\/iOS \u306a\u3089\u3070\u305d\u306e\u307e\u307e\u52d5\u304d\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u304c\u3001\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e\u5834\u5408\u306f\u3001\u4e2d\u8eab\u306e\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u7cfb\u304c\u305d\u306e\u307e\u307e\u52d5\u304f\u304b\u3069\u3046\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u3002Tesseract \u306e\u5834\u5408 OCR \u306e\u5b66\u7fd2\u30c7\u30fc\u30bf\u306e\u305f\u3081\u306b\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002\u3053\u308c\u306f Tesseract \u81ea\u8eab\u306e\u30b3\u30fc\u30c9\u3092\u898b\u308b\u3068\u308f\u3051\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u3042\u3061\u3053\u3061\u306b fread \u95a2\u6570\u304c\u6563\u3063\u3066\u3044\u308b\u3093\u3067\u3059\u3088\u306d\u3002\u30ef\u30f3\u30d1\u30b9\u3067\u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u306e\u304b\u3001\u9069\u5f53\u306b seek \u3057\u3066\u3044\u308b\u306e\u304b\u306f\u4e0d\u660e\u3067\u3059\u304c\u3001\u3053\u308c\u3089\u3092 StorageFile \u7cfb\u306b\u5909\u3048\u308b\u306e\u306f\u307b\u307c\u4e0d\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3068\u306a\u308c\u3070\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306e fopen \u95a2\u6570\u304c\u6b63\u5e38\u306b\u52d5\u304f\u306e\u304b\u3069\u3046\u304b\uff1f\u304c\u554f\u984c\u306b\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3082\u7d50\u8ad6\u3092\u8a00\u3048\u3070\u3001\u81ea\u4f5c\u306e\u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u52d5\u304d\u307e\u3057\u305f\u3002Tesseract \u81ea\u8eab\u306f\u307e\u3060\u8a66\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u306a\u3093\u3068\u3082\u8a00\u3048\u307e\u305b\u3093\u304c\u3001getenv \u95a2\u6570\u306e\u30c0\u30df\u30fc\u3092\u4f5c\u3063\u3066\u74b0\u5883\u5909\u6570\u3092\u9069\u5f53\u306b\u64cd\u4f5c\u3057\u3066\u3084\u308c\u3070\u8aad\u307f\u8fbc\u3081\u305d\u3046\u3067\u3059\u3002<\/p>\n<h2>C# \u304b\u3089 C\u8a00\u8a9e\u30e9\u30a4\u30d6\u30e9\u30ea\u306e fopen \u3092\u547c\u3073\u51fa\u3059<\/h2>\n<p>C# \u304b\u3089 C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u76f4\u63a5\u547c\u3073\u51fa\u305b\u306a\u3044\u306e\u3067\u3001\u3068\u3053\u308d\u3069\u3053\u308d\u306b\u76f8\u4e92\u904b\u7528\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&#8211; C# \u3067\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092\u66f8\u304f\u3002<br \/>\n&#8211; C++\/CX \u3067 Windows \u30e9\u30f3\u30bf\u30a4\u30e0\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u308b\u3002<br \/>\n&#8211; C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u66f8\u304f<\/p>\n<p>\u3068\u3044\u3046\u5177\u5408\u306b\u306a\u308a\u307e\u3059\u3002\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092 C++\/CX \u3067\u66f8\u3051\u3070\u3001C# \u306e\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306f\u5fc5\u8981\u306a\u304f\u306a\u308a\u307e\u3059\u304c\u3001\u5148\u306b\u3082\u66f8\u3044\u305f\u3088\u3046\u306b\u3001C# \u306e\u307b\u3046\u304c\u30b5\u30f3\u30d7\u30eb\u6570\u304c\u5727\u5012\u7684\u306b\u591a\u3044\u306e\u3067 C# \u3067\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092\u66f8\u304f\u307b\u3046\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305f\u3001\u300cC\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u66f8\u304f\u300d\u3068\u3053\u308d\u306f\u3001C++\/CX \u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3057\u3066\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u3060\u3068 C++\/CX \u306e\u6587\u6cd5\u306b\u5bc4\u3063\u3066\u3057\u307e\u3063\u305f\u308a\u3001\u30b3\u30fc\u30c9\u306e\u4fdd\u5b88\u304c\u7169\u96d1\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u5225\u9014\u30d3\u30eb\u30c9\u3057\u305f C\/C++ \u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u9759\u7684\u306b\u30ea\u30f3\u30af\u3055\u305b\u308b\u307b\u3046\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002DLL \u306e\u5834\u5408\u306f\u3069\u3046\u3060\u3063\u305f\u306e\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u3002DLL \u81ea\u4f53\u306e\u914d\u5e03\u304c\u3084\u3084\u3053\u3057\u304f\u306a\u308b\u306e\u3067\u3001\u3053\u308c\u306f\u5225\u9014\u8981\u691c\u8a0e\u3068\u3044\u3046\u3068\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2015\/07\/wpid-dworkblogimage20150701_02org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2015\/07\/wpid-dworkblogimage20150701_02thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5f62\u5f0f\u306f\u3001<\/p>\n<p>&#8211; CheckApp &#8212; C# \u306e\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea<br \/>\n&#8211; CheckCLib &#8212; C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea<br \/>\n&#8211; CheckCppcx &#8212; \u76f8\u4e92\u904b\u7528\u306e C++\/CX \u30e9\u30a4\u30d6\u30e9\u30ea<\/p>\n<p>\u306b\u306a\u308a\u307e\u3059\u3002\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u5185\u306b\u3042\u308b Assets\/sample.txt \u3092 fopen \u3057\u3066\u8aad\u307f\u8fbc\u3082\u3046\u3068\u3044\u3046\u8a08\u753b\u3067\u3059\u3002<\/p>\n<p>C\u8a00\u8a9e\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\uff08CheckCLib\uff09\u306f\u3001\u3054\u304f\u666e\u901a\u306b fgets \u3067\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\u3092\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u30d0\u30c3\u30d5\u30a1\u306f\u9762\u5012\u306a\u306e\u3067 static \u3067\u8fd4\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u5225\u9014\u30d0\u30c3\u30d5\u30a1\u3092\u6e21\u3059\u307b\u3046\u304c\u5b89\u5168\u3067\u3059\u3002\u3053\u306e\u3042\u305f\u308a\u30e1\u30e2\u30ea\u64cd\u4f5c\u7cfb\u306e malloc\/free, new\/delete \u306e\u6271\u3044\u3082\u6ce8\u610f\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u306d\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nchar *Class2::OpenPath(const char *path)\r\n{\r\n\tFILE *fp = fopen(path, &quot;rt&quot;);\r\n\tstatic char buf&#x5B;256] = { 0 };\r\n\tfgets(buf, 256, fp);\r\n\tfclose(fp);\r\n\treturn buf;\r\n}\r\n<\/pre>\n<p>\u3053\u308c\u3092 C++\/CX \u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u304b\u3089\u547c\u3073\u51fa\u3057\u307e\u3059\u3002C# \u304b\u3089\u306f\u3001char* \u3092\u76f4\u63a5\u6271\u3048\u306a\u3044\u306e\u3067 String \u304b\u3089\u5909\u63db\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nPlatform::String^ Class1::OpenPathC(Platform::String^ fpath)\r\n{\r\n\tstd::wstring w(fpath-&gt;Data());\r\n\tstd::string s(w.begin(), w.end());\r\n\tconst char *path = s.c_str();\r\n\r\n\tauto obj = new Class2();\r\n\tauto buf = obj-&gt;OpenPath(path);\r\n\r\n\tstd::string ss(buf);\r\n\tauto text = ref new String(std::wstring(ss.begin(), ss.end()).c_str());\r\n\treturn text;\r\n}\r\n<\/pre>\n<p>C++\/CX \u3067\u306f\u6587\u5b57\u5217\u3092 Platform::String \u3067\u6271\u3044\u307e\u3059\u3002\u3053\u306e String \u306f wchar_t \u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001std::wstring \u3068 std::string \u3092\u99c6\u4f7f\u3057\u3066 const char * \u306b\u5909\u63db\u3057\u307e\u3059\u3002\u6f22\u5b57\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u3053\u308c\u3067\u306f\u99c4\u76ee\u306a\u306e\u3067\u3059\u304c\u3001ASCII \u306e\u7bc4\u7587\u3067\u3042\u308c\u3070\u3053\u308c\u3067\u5341\u5206\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e C++\/CX \u3067\u4f5c\u3063\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3092 C# \u306e\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u304b\u3089\u547c\u3073\u51fa\u3059\u3068\u6b21\u306e\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nprivate void clickOpen6(object sender, RoutedEventArgs e)\r\n{\r\n    var path = &quot;D:\\work\\OCR\\sample\\CheckApp\\CheckApp\\bin\\x86\\Debug\\AppX\\Assets\\sample.txt&quot;;\r\n    var obj = new Class1();\r\n    var text = obj.OpenPathC(path);\r\n    text1.Text = text;\r\n    text2.Text = path;\r\n}\r\n<\/pre>\n<p>\u30d1\u30b9\u304c\u3044\u3084\u306b\u76f4\u63a5\u7684\u306b\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u3067\u52d5\u304d\u307e\u3059\u3002\u5b9f\u306f\u30a2\u30af\u30bb\u30b9\u3055\u305b\u3066\u307f\u308b\u3068\u5206\u304b\u308a\u307e\u3059\u304c\u3001AppX \u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308c\u3070\u666e\u901a\u306b fopen \u3067\u304d\u307e\u3059\u304c\u3001\u305d\u308c\u4ee5\u5916\u306e\u5834\u6240\u3060\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u307e\u305f AppX \u5185\u3067\u3042\u3063\u3066\u3082\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306b\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u304d\u3063\u3061\u308a\u3068\u3001\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e StorageFile \u7cfb\u306e\u30a2\u30af\u30bb\u30b9\u7981\u6b62\u3068\u540c\u3058\u6cd5\u5247\u304c\u9069\u7528\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u7d20\u6674\u3089\u3057\u3044\u3068\u3053\u308d\u3067\u3059\u3002\u3053\u308c\u3001OS \u306e API \u30ec\u30d9\u30eb\u3067\u30ac\u30fc\u30c9\u3055\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3088\u306d\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2015\/07\/wpid-dworkblogimage20150702_01org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2015\/07\/wpid-dworkblogimage20150702_01thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3053\u3053\u306e\u30d1\u30b9\u540d\u3092\u3069\u3046\u3084\u3063\u3066\u3068\u308b\u306e\u304b\u3068\u3044\u3046\u3068\u3001\u666e\u901a\u306b ms-appx:\/\/\/ \u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nprivate async void clickOpen6(object sender, RoutedEventArgs e)\r\n{\r\n    var uri = new Uri(&quot;ms-appx:\/\/\/Assets\/sample.txt&quot;);\r\n    var file = await StorageFile.GetFileFromApplicationUriAsync(uri);\r\n    var path = file.Path;\r\n    var obj = new Class1();\r\n    var text = obj.OpenPathC(path);\r\n    text1.Text = text;\r\n    text2.Text = path;\r\n}\r\n<\/pre>\n<p>\u3053\u3093\u306a\u98a8\u306b\u3001\u4e00\u5ea6 StorageFile.GetFileFromApplicationUriAsync \u3092\u4f7f\u3063\u3066\u547c\u3073\u51fa\u3057\u3066\u3001Path \u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u53d6\u5f97\u3059\u308c\u3070\u3088\u3044\u306e\u3067\u3059\u3002\u3053\u3046\u3059\u308b\u3068\u3001\u3044\u3064\u3082\u901a\u308a\u3001ms-appx:\/\/\/ \u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u306e\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u7d76\u5bfe\u30d1\u30b9\u304c\u5206\u304b\u3089\u306a\u304f\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n<p>\u30c6\u30b9\u30c8\u6642\u306b\u4f5c\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3053\u3061\u3089\u3002\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30d1\u30b9\u7b49\u304c\u56fa\u5b9a\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u53c2\u8003\u307e\u3067\u3002<\/p>\n<p><a href=\"http:\/\/1drv.ms\/1dxzhFD\">CheckApp-v0.1-src.zip<\/a><\/p>\n<h2>\u304a\u307e\u3051<\/h2>\n<p>\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u3067\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u3092\u3059\u308b\u3068\u304d\u306b\u306f\u3001\u975e\u540c\u671f\u306e await\/async \u304c\u5fc5\u9808\u306b\u306a\u308a\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u30b3\u30fc\u30c9\u3092\u898b\u3066\u307f\u308b\u3068\u6c17\u4ed8\u304f\u3068\u601d\u3044\u307e\u3059\u304c\u3001C\u8a00\u8a9e\u306e fopen \u95a2\u6570\u306e\u5834\u5408\u306f\u540c\u671f\u7684\u306b\u4f5c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u3046\u3044\u3046\u610f\u5473\u3067\u306f\u3001\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e\u57fa\u6e96\u304b\u3089\u9038\u8131\u3057\u3066\u3044\u308b\u3088\u3046\u306b\u3082\u898b\u3048\u307e\u3059\u304c\u3001\u9006\u306b\u8a00\u3048\u3070\u3001\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u3068\u540c\u3058\u3088\u3046\u306a\u4ed5\u7d44\u307f\u3067\u30d5\u30a1\u30a4\u30eb\u30a2\u30af\u30bb\u30b9\u3092\u3059\u308b\u624b\u6bb5\u3092\u5f97\u3089\u308c\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3082\u3042\u308a\u307e\u3059\u306d\u3002\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u306e\u5834\u5408\u3001http \u30a2\u30af\u30bb\u30b9\u3057\u3066\u3061\u3089\u3061\u3089\u3068\u30c7\u30fc\u30bf\u3092\u53d6\u3063\u3066\u304f\u308b\u306e\u306b\u306f\u9069\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u304c\u308a\u304c\u308a\u3068\u52d5\u304b\u3059\u306b\u306f\u3061\u3087\u3063\u3068\u9053\u5177\u4e0d\u8db3\u3001\u3068\u8a00\u3044\u307e\u3059\u304b\u6614\u306a\u304c\u3089\u306e C\u8a00\u8a9e\u30a2\u30af\u30bb\u30b9\u304c\u697d\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u3002\u591a\u5206\u3001std::cin\/cout \u3082\u4f7f\u3048\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u306a\u3068\u601d\u3046\u306e\u3067\u3001\u3053\u306e\u3042\u305f\u308a\u306f\u5f8c\u3067\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u88dc\u8a18<\/p>\n<p>CreateFile2 function (Windows)<br \/>\nhttps:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/hh449422(v=vs.85).aspx<\/p>\n<p>When called from a Windows Store app, CreateFile2 is simplified. You can open only files or directories inside the ApplicationData.LocalFolder or Package.InstalledLocation directories. You can&#8217;t open named pipes or mailslots or create encrypted files (FILE_ATTRIBUTE_ENCRYPTED).<\/p>\n<p>\u3068\u3042\u308b\u306e\u3067\u3001\u5185\u90e8\u7684\u306b Windows \u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u3082 fopen \u3082 CreateFile2 \u95a2\u6570\u306e\u52d5\u304d\u306b\u6e96\u3058\u3066\u305d\u3046\u3068\u306e\u3053\u3068 Special thanks @biac -san .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e45\u3057\u632f\u308a\u306eC\u8a00\u8a9e\u3067\u3059\u304c\u3001\u3056\u3056\u3063\u3068\u66f8\u304d\u4e0b\u3057\u307e\u3059\u3002\u3068\u3042\u308b\u3068\u3053\u308d\u3067\u8abf\u3079\u59cb\u3081\u3066\u3061\u3087\u3063\u3068\u7a81\u3063\u8fbc\u3093\u3060\u3068\u3053\u308d\u3067\u3001\u672c\u5f53\u306b\u3067\u304d\u308b\u306e\u304b\uff1f\u3063\u3066\u306e\u3092\u8abf\u67fb\u3057\u3066\u3044\u308b\u9014\u4e2d\u3067\u3059\u3002\u3044\u3084\u3001\u6b63\u76f4\u306b\u8a00\u3046\u3068\u76ee\u7684\u3092\u9054\u3059\u308b\u624b\u6bb5\u3068\u3057\u3066\u306f\u7d50\u69cb\u5371\u3046\u3044\u306e\u3067\u3001\u307e\u3068\u3082\u306b C#  &hellip; <a href=\"https:\/\/www.moonmile.net\/blog\/archives\/7243\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,23,46],"tags":[],"class_list":["post-7243","post","type-post","status-publish","format-standard","hentry","category-dev","category-csharp","category-ccx"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/7243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=7243"}],"version-history":[{"count":7,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/7243\/revisions"}],"predecessor-version":[{"id":7250,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/7243\/revisions\/7250"}],"wp:attachment":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=7243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=7243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=7243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}