{"id":51307,"date":"2024-12-03T11:36:48","date_gmt":"2024-12-03T03:36:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/51307\/"},"modified":"2024-12-03T11:36:48","modified_gmt":"2024-12-03T03:36:48","slug":"%e4%ba%86%e8%a7%a3linux%e7%bc%93%e5%ad%98%e6%9c%ba%e5%88%b6%ef%bc%9a%e6%8f%90%e5%8d%87%e7%b3%bb%e7%bb%9f%e6%80%a7%e8%83%bd%e7%9a%84%e5%bf%85%e8%a6%81%e6%ad%a5%e9%aa%a4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/51307\/","title":{"rendered":"\u4e86\u89e3Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u4e86\u89e3Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300a\u4e86\u89e3Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4\u300b\uff0c\u8986\u76d6\u4e86\u6587\u7ae0\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002<\/p>\n<p>\u638c\u63e1Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5173\u952e\u4e00\u6b65\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b<\/p>\n<p>\u6458\u8981\uff1aLinux\u7cfb\u7edf\u7684\u7f13\u5b58\u673a\u5236\u662f\u63d0\u9ad8\u7cfb\u7edf\u6027\u80fd\u7684\u91cd\u8981\u56e0\u7d20\u4e4b\u4e00\u3002\u672c\u6587\u5c06\u4ecb\u7ecdLinux\u7684\u7f13\u5b58\u673a\u5236\uff0c\u91cd\u70b9\u4ecb\u7ecd\u9875\u9762\u7f13\u5b58\u548c\u78c1\u76d8\u7f13\u5b58\uff0c\u5e76\u7ed9\u51fa\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u8bfb\u8005\u66f4\u597d\u5730\u7406\u89e3\u548c\u5e94\u7528Linux\u7f13\u5b58\u673a\u5236\uff0c\u4ee5\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002<\/p>\n<p>\u4e00\u3001\u5f15\u8a00<br \/>\u968f\u7740\u8ba1\u7b97\u673a\u6280\u672f\u7684\u53d1\u5c55\uff0c\u73b0\u4ee3\u64cd\u4f5c\u7cfb\u7edf\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\u9762\u4e34\u7740\u6027\u80fd\u74f6\u9888\u7684\u6311\u6218\u3002\u4e3a\u4e86\u63d0\u9ad8\u7cfb\u7edf\u7684\u8fd0\u884c\u6548\u7387\uff0cLinux\u7cfb\u7edf\u5f15\u5165\u4e86\u7f13\u5b58\u673a\u5236\uff0c\u5c06\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u7f13\u5b58\u5728\u5185\u5b58\u4e2d\uff0c\u4ece\u800c\u51cf\u5c11\u78c1\u76d8IO\u7684\u6b21\u6570\uff0c\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8Linux\u7684\u7f13\u5b58\u673a\u5236\uff0c\u5e76\u901a\u8fc7\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\u6765\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u548c\u5e94\u7528Linux\u7f13\u5b58\u673a\u5236\u3002<\/p>\n<p>\u4e8c\u3001Linux\u7684\u7f13\u5b58\u673a\u5236<\/p>\n<ol>\n<li>\u9875\u9762\u7f13\u5b58<br \/>\u9875\u9762\u7f13\u5b58\u662fLinux\u4e2d\u6700\u5e38\u89c1\u7684\u7f13\u5b58\u5f62\u5f0f\u3002\u5f53\u6587\u4ef6\u88ab\u8bfb\u53d6\u5230\u5185\u5b58\u65f6\uff0c\u5b83\u4eec\u5c06\u88ab\u5b58\u50a8\u5728\u9875\u9762\u7f13\u5b58\u4e2d\u3002\u5728\u4e4b\u540e\u7684\u8bfb\u53d6\u64cd\u4f5c\u4e2d\uff0c\u5185\u6838\u9996\u5148\u68c0\u67e5\u9875\u9762\u7f13\u5b58\uff0c\u5982\u679c\u53d1\u73b0\u5df2\u7ecf\u7f13\u5b58\u4e86\u8be5\u6587\u4ef6\u7684\u9875\u9762\uff0c\u5c31\u76f4\u63a5\u4ece\u9875\u9762\u7f13\u5b58\u4e2d\u8bfb\u53d6\uff0c\u907f\u514d\u4e86\u78c1\u76d8IO\u64cd\u4f5c\u3002\u9875\u9762\u7f13\u5b58\u5bf9\u4e8e\u7ecf\u5e38\u8bfb\u53d6\u7684\u6587\u4ef6\uff08\u5982\u7cfb\u7edf\u6587\u4ef6\u3001\u5e93\u6587\u4ef6\u7b49\uff09\u975e\u5e38\u6709\u7528\u3002<\/li>\n<li>\u78c1\u76d8\u7f13\u5b58<br \/>\u9664\u4e86\u9875\u9762\u7f13\u5b58\uff0cLinux\u8fd8\u5f15\u5165\u4e86\u78c1\u76d8\u7f13\u5b58\u673a\u5236\uff0c\u5c06\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u7f13\u5b58\u5728\u5185\u5b58\u4e2d\u3002\u5f53\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5199\u5165\u6570\u636e\u5230\u78c1\u76d8\u65f6\uff0c\u5185\u6838\u9996\u5148\u5c06\u6570\u636e\u5199\u5165\u78c1\u76d8\u7f13\u5b58\u4e2d\uff0c\u5e76\u5728\u5408\u9002\u7684\u65f6\u673a\u5c06\u7f13\u5b58\u4e2d\u7684\u6570\u636e\u5199\u5165\u78c1\u76d8\uff0c\u51cf\u5c11\u4e86\u78c1\u76d8IO\u7684\u6b21\u6570\uff0c\u63d0\u9ad8\u4e86\u7cfb\u7edf\u7684\u6027\u80fd\u3002\u78c1\u76d8\u7f13\u5b58\u5bf9\u4e8e\u9891\u7e41\u5199\u5165\u78c1\u76d8\u7684\u5e94\u7528\u7a0b\u5e8f\uff08\u5982\u6570\u636e\u5e93\uff09\u975e\u5e38\u6709\u76ca\u3002<\/li>\n<\/ol>\n<p>\u4e09\u3001\u5177\u4f53\u4ee3\u7801\u793a\u4f8b<br \/>\u4e0b\u9762\u7ed9\u51fa\u4e86\u4e00\u4e9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u4f7f\u7528Linux\u7684\u7f13\u5b58\u673a\u5236\u6765\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002<\/p>\n<ol>\n<li>\n<p>\u4f7f\u7528mmap\u51fd\u6570\u8fdb\u884c\u6587\u4ef6\u7684\u5185\u5b58\u6620\u5c04<\/p>\n<pre>#include &lt;fcntl.h&gt;\n#include &lt;sys\/mman.h&gt;\n#include &lt;sys\/stat.h&gt;\n#include &lt;unistd.h&gt;\n\nint main() {\n int fd = open(\"test.txt\", O_RDONLY);\n struct stat sb;\n fstat(fd, &amp;sb);\n\n void* addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);\n \/\/ \u73b0\u5728test.txt\u6587\u4ef6\u7684\u5185\u5bb9\u88ab\u6620\u5c04\u5230\u4e86\u5185\u5b58\u4e2d\u7684addr\u5904\uff0c\u53ef\u4ee5\u76f4\u63a5\u4ece\u5185\u5b58\u4e2d\u8bfb\u53d6\u6570\u636e\n\n munmap(addr, sb.st_size);\n close(fd);\n return 0;\n}<\/pre>\n<p>\u901a\u8fc7\u4f7f\u7528mmap\u51fd\u6570\uff0c\u5c06\u6587\u4ef6&#8221;test.txt&#8221;\u6620\u5c04\u5230\u5185\u5b58\u4e2d\uff0c\u53ef\u4ee5\u76f4\u63a5\u4ece\u5185\u5b58\u4e2d\u8bfb\u53d6\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u907f\u514d\u4e86\u78c1\u76d8IO\u64cd\u4f5c\uff0c\u63d0\u5347\u4e86\u7cfb\u7edf\u7684\u6027\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528write\u51fd\u6570\u8fdb\u884c\u6570\u636e\u7684\u5199\u5165<\/p>\n<pre>#include &lt;fcntl.h&gt;\n#include &lt;unistd.h&gt;\n\nint main() {\n int fd = open(\"test.txt\", O_WRONLY | O_CREAT, 0644);\n const char* buf = \"Hello, World!\n\";\n size_t len = strlen(buf);\n\n write(fd, buf, len);\n \/\/ \u73b0\u5728\u6570\u636e\u88ab\u5199\u5165\u5230\u78c1\u76d8\u7f13\u5b58\u4e2d\uff0c\u7a0d\u540e\u4f1a\u7531\u5185\u6838\u5c06\u6570\u636e\u5199\u5165\u78c1\u76d8\n\n close(fd);\n return 0;\n}<\/pre>\n<p>\u901a\u8fc7\u4f7f\u7528write\u51fd\u6570\uff0c\u5c06\u6570\u636e\u5199\u5165\u5230\u6587\u4ef6&#8221;test.txt&#8221;\u7684\u78c1\u76d8\u7f13\u5b58\u4e2d\uff0c\u7a0d\u540e\u7531\u5185\u6838\u5c06\u6570\u636e\u5199\u5165\u78c1\u76d8\u3002\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u9891\u7e41\u7684\u78c1\u76d8IO\u64cd\u4f5c\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u6027\u80fd\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u56db\u3001\u603b\u7ed3<br \/>\u672c\u6587\u4ecb\u7ecd\u4e86Linux\u7684\u7f13\u5b58\u673a\u5236\uff0c\u91cd\u70b9\u4ecb\u7ecd\u4e86\u9875\u9762\u7f13\u5b58\u548c\u78c1\u76d8\u7f13\u5b58\uff0c\u5e76\u7ed9\u51fa\u4e86\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\u3002\u901a\u8fc7\u5408\u7406\u5730\u5e94\u7528\u7f13\u5b58\u673a\u5236\uff0c\u53ef\u4ee5\u907f\u514d\u9891\u7e41\u7684\u78c1\u76d8IO\u64cd\u4f5c\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u6027\u80fd\u3002\u8bfb\u8005\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u7684\u9700\u6c42\u548c\u5e94\u7528\u573a\u666f\uff0c\u7075\u6d3b\u5730\u5e94\u7528\u7f13\u5b58\u673a\u5236\uff0c\u4ee5\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002<\/p>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300a\u4e86\u89e3Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u7c73\u4e91\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03\u6587\u7ae0\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u63d0\u9ad8\u64cd\u4f5c\u6548\u7387\u7684\u6709\u6548\u4f7f\u7528\u7edd\u5bf9\u5b9a\u4f4d\u8fd0\u52a8\u6307\u4ee4\u65b9\u6cd5\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4 \u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5206\u4eab\u300a\u4e86\u89e3Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5fc5\u8981\u6b65\u9aa4\u300b\uff0c\u8986\u76d6\u4e86\u6587\u7ae0\u7684\u5e38\u89c1\u57fa\u7840\u77e5\u8bc6\uff0c\u5176\u5b9e\u4e00\u4e2a\u8bed\u8a00\u7684\u5168\u90e8\u77e5\u8bc6\u70b9\u4e00\u7bc7\u6587\u7ae0\u662f\u4e0d\u53ef\u80fd\u8bf4\u5b8c\u7684\uff0c\u4f46\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u95ee\u9898\uff0c\u8ba9\u8bfb\u8005\u5bf9\u81ea\u5df1\u7684\u638c\u63e1\u7a0b\u5ea6\u6709\u4e00\u5b9a\u7684\u8ba4\u8bc6(B \u6570)\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u66f4\u597d\u7684\u638c\u63e1\u5b83\u3002 \u638c\u63e1Linux\u7f13\u5b58\u673a\u5236\uff1a\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u7684\u5173\u952e\u4e00\u6b65\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b \u6458\u8981\uff1aLinux\u7cfb\u7edf\u7684\u7f13\u5b58\u673a\u5236\u662f\u63d0\u9ad8\u7cfb\u7edf\u6027\u80fd\u7684\u91cd\u8981\u56e0\u7d20\u4e4b\u4e00\u3002\u672c\u6587\u5c06\u4ecb\u7ecdLinux\u7684\u7f13\u5b58\u673a\u5236\uff0c\u91cd\u70b9\u4ecb\u7ecd\u9875\u9762\u7f13\u5b58\u548c\u78c1\u76d8\u7f13\u5b58\uff0c\u5e76\u7ed9\u51fa\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u8bfb\u8005\u66f4\u597d\u5730\u7406\u89e3\u548c\u5e94\u7528Linux\u7f13\u5b58\u673a\u5236\uff0c\u4ee5\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002 \u4e00\u3001\u5f15\u8a00\u968f\u7740\u8ba1\u7b97\u673a\u6280\u672f\u7684\u53d1\u5c55\uff0c\u73b0\u4ee3\u64cd\u4f5c\u7cfb\u7edf\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\u9762\u4e34\u7740\u6027\u80fd\u74f6\u9888\u7684\u6311\u6218\u3002\u4e3a\u4e86\u63d0\u9ad8\u7cfb\u7edf\u7684\u8fd0\u884c\u6548\u7387\uff0cLinux\u7cfb\u7edf\u5f15\u5165\u4e86\u7f13\u5b58\u673a\u5236\uff0c\u5c06\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u7f13\u5b58\u5728\u5185\u5b58\u4e2d\uff0c\u4ece\u800c\u51cf\u5c11\u78c1\u76d8IO\u7684\u6b21\u6570\uff0c\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8Linux\u7684\u7f13\u5b58\u673a\u5236\uff0c\u5e76\u901a\u8fc7\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\u6765\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u548c\u5e94\u7528Linux\u7f13\u5b58\u673a\u5236\u3002 \u4e8c\u3001Linux\u7684\u7f13\u5b58\u673a\u5236 \u9875\u9762\u7f13\u5b58\u9875\u9762\u7f13\u5b58\u662fLinux\u4e2d\u6700\u5e38\u89c1\u7684\u7f13\u5b58\u5f62\u5f0f\u3002\u5f53\u6587\u4ef6\u88ab\u8bfb\u53d6\u5230\u5185\u5b58\u65f6\uff0c\u5b83\u4eec\u5c06\u88ab\u5b58\u50a8\u5728\u9875\u9762\u7f13\u5b58\u4e2d\u3002\u5728\u4e4b\u540e\u7684\u8bfb\u53d6\u64cd\u4f5c\u4e2d\uff0c\u5185\u6838\u9996\u5148\u68c0\u67e5\u9875\u9762\u7f13\u5b58\uff0c\u5982\u679c\u53d1\u73b0\u5df2\u7ecf\u7f13\u5b58\u4e86\u8be5\u6587\u4ef6\u7684\u9875\u9762\uff0c\u5c31\u76f4\u63a5\u4ece\u9875\u9762\u7f13\u5b58\u4e2d\u8bfb\u53d6\uff0c\u907f\u514d\u4e86\u78c1\u76d8IO\u64cd\u4f5c\u3002\u9875\u9762\u7f13\u5b58\u5bf9\u4e8e\u7ecf\u5e38\u8bfb\u53d6\u7684\u6587\u4ef6\uff08\u5982\u7cfb\u7edf\u6587\u4ef6\u3001\u5e93\u6587\u4ef6\u7b49\uff09\u975e\u5e38\u6709\u7528\u3002 \u78c1\u76d8\u7f13\u5b58\u9664\u4e86\u9875\u9762\u7f13\u5b58\uff0cLinux\u8fd8\u5f15\u5165\u4e86\u78c1\u76d8\u7f13\u5b58\u673a\u5236\uff0c\u5c06\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u7f13\u5b58\u5728\u5185\u5b58\u4e2d\u3002\u5f53\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5199\u5165\u6570\u636e\u5230\u78c1\u76d8\u65f6\uff0c\u5185\u6838\u9996\u5148\u5c06\u6570\u636e\u5199\u5165\u78c1\u76d8\u7f13\u5b58\u4e2d\uff0c\u5e76\u5728\u5408\u9002\u7684\u65f6\u673a\u5c06\u7f13\u5b58\u4e2d\u7684\u6570\u636e\u5199\u5165\u78c1\u76d8\uff0c\u51cf\u5c11\u4e86\u78c1\u76d8IO\u7684\u6b21\u6570\uff0c\u63d0\u9ad8\u4e86\u7cfb\u7edf\u7684\u6027\u80fd\u3002\u78c1\u76d8\u7f13\u5b58\u5bf9\u4e8e\u9891\u7e41\u5199\u5165\u78c1\u76d8\u7684\u5e94\u7528\u7a0b\u5e8f\uff08\u5982\u6570\u636e\u5e93\uff09\u975e\u5e38\u6709\u76ca\u3002 \u4e09\u3001\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\u4e0b\u9762\u7ed9\u51fa\u4e86\u4e00\u4e9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u4f7f\u7528Linux\u7684\u7f13\u5b58\u673a\u5236\u6765\u63d0\u5347\u7cfb\u7edf\u7684\u6027\u80fd\u3002 \u4f7f\u7528mmap\u51fd\u6570\u8fdb\u884c\u6587\u4ef6\u7684\u5185\u5b58\u6620\u5c04 #include &lt;fcntl.h&gt; #include &lt;sys\/mman.h&gt; #include &lt;sys\/stat.h&gt; #include &lt;unistd.h&gt; int main() { int fd = open(&#8220;test.txt&#8221;, O_RDONLY); struct stat sb; fstat(fd, &amp;sb); void* addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); \/\/ \u73b0\u5728test.txt\u6587\u4ef6\u7684\u5185\u5bb9\u88ab\u6620\u5c04\u5230\u4e86\u5185\u5b58\u4e2d\u7684addr\u5904\uff0c\u53ef\u4ee5\u76f4\u63a5\u4ece\u5185\u5b58\u4e2d\u8bfb\u53d6\u6570\u636e munmap(addr, sb.st_size); close(fd); return 0; } \u901a\u8fc7\u4f7f\u7528mmap\u51fd\u6570\uff0c\u5c06\u6587\u4ef6&#8221;test.txt&#8221;\u6620\u5c04\u5230\u5185\u5b58\u4e2d\uff0c\u53ef\u4ee5\u76f4\u63a5\u4ece\u5185\u5b58\u4e2d\u8bfb\u53d6\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u907f\u514d\u4e86\u78c1\u76d8IO\u64cd\u4f5c\uff0c\u63d0\u5347\u4e86\u7cfb\u7edf\u7684\u6027\u80fd\u3002 \u4f7f\u7528write\u51fd\u6570\u8fdb\u884c\u6570\u636e\u7684\u5199\u5165 #include &lt;fcntl.h&gt; #include &lt;unistd.h&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-51307","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=51307"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51307\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=51307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=51307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=51307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}