{"id":125738,"date":"2020-01-10T11:01:17","date_gmt":"2020-01-10T03:01:17","guid":{"rendered":"http:\/\/4563.org\/?p=125738"},"modified":"2020-01-10T11:01:17","modified_gmt":"2020-01-10T03:01:17","slug":"go-os-file-%e7%9a%84%e7%96%91%e9%97%ae","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=125738","title":{"rendered":"GO os.File \u7684\u7591\u95ee"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  GO os.File \u7684\u7591\u95ee               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yujianwjj <\/span>  <span><i><\/i> 64<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>go \u6807\u51c6\u5e93\u4e2d\u7684 <code>os.File<\/code> \u5185\u90e8\u5b9e\u73b0\u5982\u4e0b\uff1a<\/p>\n<pre><code>type File struct {  *file \/\/ os specific }  type file struct {  pfd         poll.FD  name        string  dirinfo     *dirInfo \/\/ nil unless directory being read  nonblock    bool     \/\/ whether we set nonblocking mode  stdoutOrErr bool     \/\/ whether this is stdout or stderr  appendMode  bool     \/\/ whether file is opened for appending } <\/code><\/pre>\n<p>\u6211\u7684\u7591\u95ee\u662f\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u76f4\u63a5\u7528\u4e0b\u9762\u7684\u65b9\u5f0f<\/p>\n<pre><code>type File struct {  pfd         poll.FD  name        string  dirinfo     *dirInfo \/\/ nil unless directory being read  nonblock    bool     \/\/ whether we set nonblocking mode  stdoutOrErr bool     \/\/ whether this is stdout or stderr  appendMode  bool     \/\/ whether file is opened for appending } <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"51947\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ArJun <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9762\u5411\u5bf9\u8c61\u5f00\u53d1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51948\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : airfling <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c0f\u5199\u7684\u662f\u79c1\u6709\u5c5e\u6027,\u7c7b\u4f3c\u4e8e java \u4e2d private\uff0c\u5bf9\u5916\u66b4\u9732\u7684\u662f\u65b9\u6cd5\u548c\u6784\u9020\u65b9\u6cd5\u90fd\u662f\u4f9d\u9760\u6307\u9488\u64cd\u4f5c\uff0c\u9632\u6b62\u5916\u4eba\u901a\u8fc7\u53cd\u5c04\u4fee\u6539\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51949\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : magua <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u79c1\u6709\u5316\uff0c\u53ef\u4ee5\u9632\u6b62\u5916\u90e8\u4fee\u6539 file \u7ed3\u6784\u4f53\u7684\u503c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51950\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codehz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u539f\u56e0\u5df2\u7ecf\u5728\u6ce8\u91ca\u91cc\u4e86\uff1aos specific<br \/>\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u7684\u6587\u4ef6\u7ed3\u6784\u4f53\u53ef\u80fd\u4e0d\u540c\uff0c\u5bfc\u81f4\u7ed3\u6784\u4f53\u5927\u5c0f\u4e5f\u4e0d\u4e00\u81f4\uff0c\u52a0\u4e00\u4e2a\u95f4\u63a5\u6307\u9488\u4ee5\u540e\uff0c\u5927\u5c0f\u5c31\u786e\u5b9a\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51951\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : heimeil <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             file.go<br \/>file_plan9.go<br \/>file_posix.go<br \/>file_unix.go<br \/>file_windows.go<\/p>\n<p>\u6bcf\u4e2a\u5e73\u53f0\u7684\u6587\u4ef6\u7684\u5b9a\u4e49\u90fd\u4e0d\u592a\u4e00\u6837\uff0c\u5c31\u5206\u5f00\u5b9a\u4e49\u4e86 file\uff0c\u7136\u540e\u518d\u7528\u4e00\u4e2a\u6307\u9488\u5c01\u88c5\u5230 File \u91cc\uff0c\u5c4f\u853d\u5404\u5e73\u53f0\u95f4\u7684\u5dee\u5f02                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51952\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yujianwjj <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             type File struct {<br \/> *file \/\/ os specific<br \/>}<br \/>\u4e3a\u4ec0\u4e48\u7528\u6307\u9488\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u5185\u5d4c\u7ed3\u6784\u4f53<br \/>type File struct {<br \/> file \/\/ os specific<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51953\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : monsterxx03 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528\u6307\u9488\u7684\u8bdd, \u5b9e\u9645\u7684 file \u662f\u5206\u914d\u5728 heap \u4e0a\u7684(go runtime \u7684 heap), \u5728\u6808\u4e0a\u603b\u662f\u53ea\u6709\uff18\u5b57\u8282\u7684\u6307\u9488, \u6bcf\u6b21\u6808\u8fd4\u56de\u7684\u65f6\u5019\u5c31\u53ea\u7528\u62f7\u8d1d\u6307\u9488\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"51954\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : reus <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ce8\u91ca\u91cc\u5199\u4e86\u554a\uff0cos specific<\/p>\n<p>\u4f60\u5199\u7684 type file &#8230; \u53ea\u662f unix \u7684\uff0cwindows \u6709\u4e0d\u540c\u7684\u5b9a\u4e49\uff0cplan9 \u4e5f\u6709\u4e0d\u540c\u7684\u5b9a\u4e49                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>GO os.File \u7684\u7591\u95ee \u8cc7\u6df1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/125738"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=125738"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/125738\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=125738"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=125738"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=125738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}