{"id":267519,"date":"2015-11-05T10:54:03","date_gmt":"2015-11-05T07:54:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=267519"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=267519","title":{"rendered":"[\u041f\u0435\u0440\u0435\u0432\u043e\u0434] \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f D"},"content":{"rendered":"<p>       <i>\u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0413\u044d\u0440\u0438 \u0423\u0438\u043b\u043b\u043e\u0443\u0431\u0438 (Gary Willoughby) \u00ab<a href=\"http:\/\/nomad.so\/2015\/09\/working-with-files-in-the-d-programming-language\/\">Working with files in the D programming language<\/a>\u00bb, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0439 28 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2015 \u0433\u043e\u0434\u0430.<\/i><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u043c\u0435\u043d\u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0435\u043b\u044c \u043d\u0430\u0437\u0430\u0434 \u0438 \u043e\u0437\u0430\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f <a href=\"http:\/\/devdungeon.com\/content\/working-files-go\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 Go<\/a> (\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u2014 <i>\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.<\/i>). \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0432\u0442\u043e\u0440 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u044f\u0437\u044b\u043a\u0430 <a href=\"https:\/\/golang.org\/\">Go<\/a>. \u0418 \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u0442, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043e\u043f\u0438\u0441\u0430\u0432, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 \u044f\u0437\u044b\u043a\u0435 <a href=\"http:\/\/dlang.org\/\">D<\/a>.<\/p>\n<p>  \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043b\u044e\u0431\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0445\u043e\u0442\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u2014 \u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0435, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 D. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0438 \u043c\u043e\u0449\u044c \u044f\u0437\u044b\u043a\u0430 D \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438.<\/p>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0435\u0434\u0438\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (Uniform Function Call Syntax, UFCS). \u041f\u0443\u0441\u0442\u044c \u043e\u043d \u0432\u0430\u0441 \u043d\u0435 \u0441\u043c\u0443\u0449\u0430\u0435\u0442: \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0435\u0433\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"http:\/\/nomad.so\/2013\/08\/alternative-function-syntax-in-d\/\">\u0437\u0434\u0435\u0441\u044c<\/a> (<em>\u043f\u043e\u043a\u0430 \u0442\u043e\u0436\u0435 \u0430\u043d\u0433\u043b. \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.<\/em>).<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c<\/h2>\n<p>  <\/p>\n<h3>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b<\/h3>\n<p>  \u041d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u0412\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, D \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u043e\u043d\u043a\u0438\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f\u0437\u044b\u043a\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B8_(%D1%8F%D0%B7%D1%8B%D0%BA_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\">C<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430 \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u043f\u043e \u043c\u043d\u043e\u0433\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c. \u0422\u0438\u043f <code>File<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041b\u0435\u0436\u0430\u0449\u0438\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D0%BE%D0%B4%D1%81%D1%87%D1%91%D1%82_%D1%81%D1%81%D1%8B%D0%BB%D0%BE%D0%BA\">\u043f\u043e\u0434\u0441\u0447\u0451\u0442\u043e\u043c \u0441\u0441\u044b\u043b\u043e\u043a<\/a>, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 <code>File<\/code> \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"cpp\">import core.stdc.errno; import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\t\/\/ \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 File \u2014 \u044d\u0442\u043e \u0440\u0435\u0436\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443, \u043e\u043d \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \t\t\/\/ \u0440\u0435\u0436\u0438\u043c\u0443 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fopen \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 C. \t\t\/\/ \t\t\/\/ r \u2014 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435. \u0424\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \t\t\/\/ w \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \t\t\/\/ \u0438\u043c\u0435\u043d\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u043e, \u0438 \t\t\/\/ \u0444\u0430\u0439\u043b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c. \t\t\/\/ a \u2014 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0444\u0430\u0439\u043b\u0430. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \t\t\/\/ \u0432\u0441\u0435\u0433\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u043e\u0431\u044a\u0451\u043c. \t\t\/\/ \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \t\t\/\/ \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f. \t\t\/\/ r+ \u2014 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 (\u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c). \t\t\/\/ \u0424\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \t\t\/\/ w+ \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 (\u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \t\t\/\/ \u0438 \u0437\u0430\u043f\u0438\u0441\u044c). \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441 \u0442\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \t\t\/\/    \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0438 \u0444\u0430\u0439\u043b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c. \t\t\/\/ a+ \u2014 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 (\u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c), \u043f\u0440\u0438\u0447\u0451\u043c \u0432\u0441\u0435 \t\t\/\/ \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430. \t\t\/\/ \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0447\u0442\u0435\u043d\u0438\u044f, \t\t\/\/ \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430. \t\t\/\/ \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f.  \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;);  \t\t\/\/ \u0424\u0430\u0439\u043b \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \t\t\/\/ \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e. \t\tfile.close(); \t\t\/\/ \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.: \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u0430\u0440\u0430\u043d\u043e\u0438\u043a \u0432\u0440\u043e\u0434\u0435 \u043c\u0435\u043d\u044f \u0438 \u0442\u0430\u043a\u0438 \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \t\t\/\/ \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \t\t\/\/ Go'\u0448\u043d\u043e\u0433\u043e defer: \t\t\/\/ scope(exit) file.close(); \t} \tcatch (ErrnoException ex) \t{ \t\tswitch(ex.errno) \t\t{ \t\t\tcase EPERM: \t\t\tcase EACCES: \t\t\t\t\/\/ \u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d \t\t\t\tbreak;  \t\t\tcase ENOENT: \t\t\t\t\/\/ \u0424\u0430\u0439\u043b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \t\t\t\tbreak;  \t\t\tdefault: \t\t\t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \t\t\t\tbreak;  \t\t} \t} } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u0440\u043e\u0448\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0444\u0430\u0439\u043b\u0443, \u0438 \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>errno<\/code> \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0438\u043f <code>File<\/code> \u2014 \u044d\u0442\u043e \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 C, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0432 <code>core.stdc.errno<\/code>. \u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a. \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>std.file.getAttributes<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u042d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%91%D0%B8%D1%82%D0%BE%D0%B2%D0%BE%D0%B5_%D0%BF%D0%BE%D0%BB%D0%B5\">\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0444\u043b\u0430\u0433\u043e\u0432<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u044d\u0442\u0438\u0445 \u0444\u043b\u0430\u0433\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.getAttributes\">\u0437\u0434\u0435\u0441\u044c<\/a> (<em>\u0430\u043d\u0433\u043b. \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.<\/em>).<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0418\u0449\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u0444\u0430\u0439\u043b\u0435<\/h3>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c, \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u0444\u0430\u0439\u043b\u0435. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;);  \t\t\/\/ \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 10 \u0431\u0430\u0439\u0442 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u0430. \t\tfile.seek(10, SEEK_SET);  \t\t\/\/ \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 2 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430\u0437\u0430\u0434 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \t\tfile.seek(-2, SEEK_CUR);  \t\t\/\/ \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 4 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430\u0437\u0430\u0434 \u043e\u0442 \u043a\u043e\u043d\u0446\u0430 \u0444\u0430\u0439\u043b\u0430. \t\tfile.seek(-4, SEEK_END);  \t\t\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f. \t\tauto pos = file.tell();  \t\t\/\/ \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0430\u0434 \u043a \u043d\u0430\u0447\u0430\u043b\u0443 \u0444\u0430\u0439\u043b\u0430. \t\tfile.rewind(); \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.seek\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0431\u0430\u0439\u0442\u044b \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tbyte[] data = [0x68, 0x65, 0x6c, 0x6c, 0x6f];  \t\tauto file = File(&quot;test.txt&quot;, &quot;w&quot;);  \t\tfile.rawWrite(data); \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.rawWrite\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0411\u044b\u0441\u0442\u0440\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043c\u043f \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u0430. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \ttry \t{ \t\twrite(&quot;test.txt&quot;, [0x68, 0x65, 0x6c, 0x6c, 0x6f]); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0442\u0430\u043a \u0436\u0435 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0438 \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.write\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u0444\u0430\u0439\u043b\u0430. \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tauto file = File(&quot;test.txt&quot;, &quot;w&quot;);  \t\t\/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443. \t\tfile.write(&quot;1: Lorem ipsum\\n&quot;);  \t\t\/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \t\tfile.writeln(&quot;2: Lorem ipsum&quot;);  \t\t\/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \t\tfile.writef(&quot;3: %s&quot;, &quot;Lorem ipsum\\n&quot;);  \t\t\/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438. \t\tfile.writefln(&quot;4: %s&quot;, &quot;Lorem ipsum&quot;); \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.write\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D0%B2%D0%BE%D0%B4-%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4\">\u0432\u0432\u043e\u0434\u0435-\u0432\u044b\u0432\u043e\u0434\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a<\/a>. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.outbuffer;  void main(string[] args) { \tauto buffer  = new OutBuffer(); \tubyte[] data = [0x68, 0x65, 0x6c, 0x6c, 0x6f];  \tbuffer.write(data); \tbuffer.write(' '); \tbuffer.write(&quot;world&quot;);  \ttry \t{ \t\twrite(&quot;test.txt&quot;, buffer.toBytes()); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a. \u042d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a \u0438 \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0438\u0437\u043d\u043e\u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_outbuffer.html\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0427\u0438\u0442\u0430\u0435\u043c \u0431\u0430\u0439\u0442\u044b \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0438\u0437 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tbyte[] buffer; \t\tbuffer.length = 1024;  \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;);  \t\tauto data = file.rawRead(buffer); \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0431\u0430\u0439\u0442\u043e\u0432 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"http:\/\/dlang.org\/arrays.html#dynamic-arrays\">\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432<\/a> \u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 1024 \u0431\u0430\u0439\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0447\u0442\u0435\u043d\u0438\u0435\u043c. \u041c\u0435\u0442\u043e\u0434 <code>rawRead<\/code> \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u0443\u0444\u0435\u0440 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <a href=\"http:\/\/dlang.org\/d-array-article.html\">\u0441\u0440\u0435\u0437<\/a> \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430. \u0414\u043b\u0438\u043d\u0430 \u0431\u0443\u0444\u0435\u0440\u0430 \u2014 \u044d\u0442\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u044b.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.rawRead\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a><\/p>\n<h3>\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u0430. \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \ttry \t{ \t\tauto data = cast(byte[]) read(&quot;test.txt&quot;); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0438\u043f\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Void\">void<\/a>. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D1%82%D0%B8%D0%BF%D0%B0\">\u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438<\/a> \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u043d \u0431\u044b\u043b \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u043a \u0442\u0438\u043f\u0443 \u00ab\u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442\u043e\u0432\u00bb.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.read\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0427\u0438\u0442\u0430\u0435\u043c n \u0431\u0430\u0439\u0442 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043d\u043e\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>read<\/code>, \u043d\u043e \u043d\u0430 \u0441\u0435\u0439 \u0440\u0430\u0437 \u0441\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c, \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442\u043e\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043b\u0438\u043c\u0438\u0442\u0430, \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \ttry \t{ \t\tauto data = cast(byte[]) read(&quot;test.txt&quot;, 5); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0438\u043f\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.read\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f.<\/p>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438<\/h3>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0444\u0430\u0439\u043b \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438 \u043f\u043e 1024 \u0431\u0430\u0439\u0442.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;);  \t\tforeach (buffer; file.byChunk(1024)) \t\t{ \t\t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e buffer \t\t} \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 <code>byChunk<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <a href=\"http:\/\/dlang.org\/phobos\/std_range.html\">\u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d<\/a> \u0431\u0430\u0439\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0443\u044e \u043f\u043e\u0440\u0446\u0438\u044e. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432\u0435\u0440\u043d\u0451\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 1024 \u0431\u0430\u0439\u0442\u0430. \u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0431\u0443\u0444\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0445 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.byChunk\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0427\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;); \t\tstring line;  \t\twhile ((line = file.readln()) !is null) \t\t{ \t\t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e line \t\t} \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u0425\u043e\u0442\u044f \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a: \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>readln<\/code> \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  \u0412\u0432\u0438\u0434\u0443 \u044d\u0442\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D0%B5%D1%80%D0%B5%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B0_%D0%BF%D1%80%D0%BE%D1%86%D0%B5%D0%B4%D1%83%D1%80_%D0%B8_%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%B9\">\u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/a>, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0431\u0443\u0444\u0435\u0440 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;); \t\tchar[] buffer;  \t\twhile (file.readln(buffer)) \t\t{ \t\t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e buffer \t\t} \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u044d\u0442\u043e\u0442 \u0431\u0443\u0444\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043d\u043e\u0432\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 (\u0447\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c). \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438, \u0438\u0445 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c. D \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0440\u0435\u0448\u0430\u0442\u044c, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.readln\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0427\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u0430\u043a \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0441\u0442\u0440\u043e\u043a<\/h3>\n<p>  \u0427\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043a\u0430\u043a \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"http:\/\/dlang.org\/phobos\/index.html\">Phobos<\/a>. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre><code class=\"cpp\">import std.exception; import std.stdio;  void main(string[] args) { \ttry \t{ \t\tauto file = File(&quot;test.txt&quot;, &quot;r&quot;);  \t\tforeach (line; file.byLine) \t\t{ \t\t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e line \t\t} \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 <code>byLine<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0444\u0430\u0439\u043b\u0430 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430 \u0440\u0430\u0437. \u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0431\u0443\u0444\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0445 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>byLineCopy<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File.byLine\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u0430\u043a \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430<\/h3>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0432 \u043e\u0434\u043d\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 \u00ab\u0441\u0442\u0440\u043e\u043a\u0430\u00bb.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.utf;  void main(string[] args) { \ttry \t{ \t\t\/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f UTF8-\u0444\u0430\u0439\u043b\u0430. \t\tauto utf8Data  = readText(&quot;test.txt&quot;);  \t\t\/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f UTF16-\u0444\u0430\u0439\u043b\u0430. \t\tauto utf16Data = readText!(wstring)(&quot;test.txt&quot;);  \t\t\/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f utf32-\u0444\u0430\u0439\u043b\u0430.. \t\tauto utf32Data = readText!(dstring)(&quot;test.txt&quot;); \t} \tcatch (UTFException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0447\u0438\u0442\u0430\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043e\u043a (\u0448\u0438\u0440\u0438\u043d\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432) \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u043c\u0443 \u0442\u0438\u043f\u0443, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.readText\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h2>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u041d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b (\u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0436\u0435 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442) \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0438\u043f\u0430 <code>File<\/code>. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441 \u0442\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0438 \u0444\u0430\u0439\u043b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c.<\/p>\n<pre><code class=\"cpp\">import std.exception;  void main(string[] args) { \ttry \t{ \t\tFile(&quot;test.txt&quot;, &quot;w&quot;); \t} \tcatch (ErrnoException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_stdio.html#.File\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code>import std.file;  void main(string[] args) { \tif (exists(&quot;test.txt&quot;)) \t{ \t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0430\u0439\u043b \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.exists\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0438\/\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442 \u0444\u0430\u0439\u043b. \u0415\u0441\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \ttry \t{ \t\trename(&quot;source.txt&quot;, &quot;destination.txt&quot;); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.rename\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u0439\u043b. \u0415\u0441\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \ttry \t{ \t\tcopy(&quot;source.txt&quot;, &quot;destination.txt&quot;); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.copy\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \ttry \t{ \t\tremove(&quot;test.txt&quot;); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.remove\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0444\u0430\u0439\u043b\u0435<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0430\u0439\u043b\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u0432\u044b \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Stat_(system_call)\">stat<\/a> (<em>\u0430\u043d\u0433\u043b.: \u0441\u043e\u0440\u0440\u0438, \u0432 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u0440\u0443\u0441\u0441\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.<\/em>) \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/POSIX\">POSIX-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439<\/a> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>attributes<\/code>.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.stdio : writefln;  void main(string[] args) { \ttry \t{ \t\tauto file = DirEntry(&quot;test.txt&quot;);  \t\twritefln(&quot;\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430: %s&quot;, file.name); \t\twritefln(&quot;\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u043c: %s&quot;, file.isDir); \t\twritefln(&quot;\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u043c: %s&quot;, file.isFile); \t\twritefln(&quot;\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u043e\u0439: %s&quot;, file.isSymlink); \t\twritefln(&quot;\u0420\u0430\u0437\u043c\u0435\u0440 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445: %s&quot;, file.size); \t\twritefln(&quot;\u0412\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430: %s&quot;, file.timeLastAccessed); \t\twritefln(&quot;\u0412\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f: %s&quot;, file.timeLastModified); \t\twritefln(&quot;\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b: %b&quot;, file.attributes); \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.DirEntry\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0423\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0443\u0441\u0435\u043a\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b \u0434\u043e 100 \u0431\u0430\u0439\u0442. \u0415\u0441\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043c\u0435\u043d\u044c\u0448\u0435, \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<pre><code class=\"cpp\">import std.file;  void main(string[] args) { \tauto file = &quot;test.txt&quot;; \tauto size = 100;  \ttry \t{ \t\tif (file.exists() && file.isFile()) \t\t{ \t\t\twrite(file, read(file, size)); \t\t} \t} \tcatch (FileException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_file.html#.write\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h2>\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 zip-\u0430\u0440\u0445\u0438\u0432\u0430<\/h3>\n<p>  \u041e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c zip-\u0430\u0440\u0445\u0438\u0432.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.outbuffer; import std.string; import std.zip;  void main(string[] args) { \ttry \t{ \t\tauto file = new ArchiveMember(); \t\tfile.name = &quot;test.txt&quot;;  \t\tauto data = new OutBuffer(); \t\tdata.write(&quot;Lorem ipsum&quot;); \t\tfile.expandedData = data.toBytes();  \t\tauto zip = new ZipArchive(); \t\tzip.addMember(file);  \t\twrite(&quot;test.zip&quot;, zip.build()); \t} \tcatch (ZipException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_zip.html#.ZipArchive\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 zip-\u0430\u0440\u0445\u0438\u0432\u0430<\/h3>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c zip-\u0430\u0440\u0445\u0438\u0432.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.zip;  void main(string[] args) { \ttry \t{ \t\tauto zip = new ZipArchive(read(&quot;test.zip&quot;));  \t\tforeach (filename, member; zip.directory) \t\t{ \t\t\tauto data = zip.expand(member);  \t\t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e data \t\t} \t} \tcatch (ZipException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_zip.html#.ZipArchive\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h2>\u0421\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u0436\u0430\u0442\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u0441\u0436\u0438\u043c\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0438\u0445 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.zlib;  void main(string[] args) { \ttry \t{ \t\tauto data = compress(&quot;Lorem ipsum dolor sit amet&quot;);  \t\twrite(&quot;test.dat&quot;, data); \t} \tcatch (ZlibException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0436\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0436\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043b\u044e\u0431\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041c\u043e\u0434\u0443\u043b\u044c <code>std.zlib<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"http:\/\/www.zlib.net\/\">Zlib<\/a> \u044f\u0437\u044b\u043a\u0430 C.<\/p>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_zlib.html#.compress\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 \u0441\u0436\u0430\u0442\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0436\u0430\u0442\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">import std.file; import std.zlib;  void main(string[] args) { \ttry \t{ \t\tauto data = uncompress(read(&quot;test.dat&quot;));  \t\t\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0435\u0441\u0436\u0430\u0442\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \t} \tcatch (ZlibException ex) \t{ \t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \t} } <\/code><\/pre>\n<p>  <a href=\"http:\/\/dlang.org\/phobos\/std_zlib.html#.uncompress\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h2>POSIX-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<h3>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/POSIX\">POSIX-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445<\/a> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Linux\">Linux<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Mac_OS\">Mac OS<\/a>. \u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"http:\/\/dlang.org\/phobos\/index.html\">Phobos<\/a> \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u0442 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%BD%D1%8B%D0%B9_%D0%B2%D1%8B%D0%B7%D0%BE%D0%B2\">\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b<\/a>, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0434\u043b\u044f POSIX.<\/p>\n<pre><code class=\"cpp\">import core.stdc.errno; import core.sys.posix.sys.stat; import std.conv; import std.string;  void main(string[] args) { \tauto file   = &quot;test.txt&quot;; \tauto result = chmod(file.toStringz(), octal!(666));  \tif (result != 0) \t{ \t\tswitch(errno) \t\t{ \t\t\tcase EPERM: \t\t\tcase EACCES: \t\t\t\t\/\/ \u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d \t\t\t\tbreak;  \t\t\tcase ENOENT: \t\t\t\t\/\/ \u0424\u0430\u0439\u043b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \t\t\t\tbreak;  \t\t\tdefault: \t\t\t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \t\t\t\tbreak; \t\t} \t} } <\/code><\/pre>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>chmod<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 <code>chmod<\/code> \u0438\u0437 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BC%D0%B0%D0%BD%D0%B4%D0%BD%D0%B0%D1%8F_%D0%BE%D0%B1%D0%BE%D0%BB%D0%BE%D1%87%D0%BA%D0%B0_UNIX\">\u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 Unix<\/a>. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0438 \u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0435 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D0%B0%D0%B2%D0%B0_%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B0\">\u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/a> (\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D0%BE%D1%81%D1%8C%D0%BC%D0%B5%D1%80%D0%B8%D1%87%D0%BD%D0%B0%D1%8F_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0_%D1%81%D1%87%D0%B8%D1%81%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F\">\u0432\u043e\u0441\u044c\u043c\u0435\u0440\u0438\u0447\u043d\u043e\u0433\u043e<\/a> \u0447\u0438\u0441\u043b\u0430). \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0441\u0430\u043c\u0443 \u044d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Root\">\u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c<\/a>.<\/p>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Chmod\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0444\u0430\u0439\u043b\u0430 \u0432 POSIX-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435\u0441\u044c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0444\u0430\u0439\u043b\u0430, \u043d\u0435 \u0431\u0443\u0434\u0443\u0447\u0438 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c.<\/p>\n<pre><code class=\"cpp\">import core.stdc.errno; import core.sys.posix.pwd; import core.sys.posix.unistd; import std.string;  void main(string[] args) { \tauto username = &quot;gary&quot;; \tauto file     = &quot;test.txt&quot;; \tauto record   = getpwnam(username.toStringz());  \tif (record !is null) \t{ \t\tauto user   = record.pw_uid; \t\tauto group  = record.pw_gid; \t\tauto result = chown(file.toStringz(), user, group);  \t\tif (result != 0) \t\t{ \t\t\tswitch(errno) \t\t\t{ \t\t\t\tcase EPERM: \t\t\t\t\t\/\/ \u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d \t\t\t\t\tbreak;  \t\t\t\tdefault: \t\t\t\t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \t\t\t\t\tbreak; \t\t\t} \t\t} \t} } <\/code><\/pre>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>chown<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 <code>chown<\/code> \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 Unix. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0438 \u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0439 \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0438 \u0433\u0440\u0443\u043f\u043f\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0444\u0430\u0439\u043b\u0430, \u0432\u0430\u0448\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Chown\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0436\u0451\u0441\u0442\u043a\u0438\u0445 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0441\u044b\u043b\u043e\u043a<\/h3>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u0432 POSIX-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%96%D1%91%D1%81%D1%82%D0%BA%D0%B0%D1%8F_%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B0\">\u0436\u0451\u0441\u0442\u043a\u0443\u044e<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B8%D0%BC%D0%B2%D0%BE%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F_%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B0\">\u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e<\/a> \u0441\u0441\u044b\u043b\u043a\u0443. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0436\u0451\u0441\u0442\u043a\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443.<\/p>\n<pre><code class=\"cpp\">import core.stdc.errno; import core.sys.posix.unistd; import std.string;  void main(string[] args) { \tauto file   = &quot;test.txt&quot;; \tauto linked = &quot;link.txt&quot;; \tauto result = link(file.toStringz(), linked.toStringz());  \tif (result != 0) \t{ \t\tswitch(errno) \t\t{ \t\t\tcase EPERM: \t\t\tcase EACCES: \t\t\t\t\/\/ \u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d \t\t\t\tbreak;  \t\t\tcase EEXIST: \t\t\t\t\/\/ \u0421\u0441\u044b\u043b\u043a\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \t\t\t\tbreak;  \t\t\tcase ENOENT: \t\t\t\t\/\/ \u0424\u0430\u0439\u043b \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442  \t\t\tdefault: \t\t\t\t\/\/ \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \t\t\t\tbreak; \t\t} \t} } <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443, \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443<br \/>  <code>auto result = link(file.toStringz(), linked.toStringz());<\/code><br \/>  \u0441\u0442\u0440\u043e\u043a\u043e\u0439<br \/>  <code>auto result = symlink(file.toStringz(), linked.toStringz());<\/code><\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0420\u0435\u0434\u043a\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c, \u043e\u0441\u043e\u0431\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043c\u043e\u0449\u044c \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u044f\u0437\u044b\u043a\u0430 D \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u0430 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438.<\/a>       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/270189\/\"> http:\/\/habrahabr.ru\/post\/270189\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <i>\u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 \u0413\u044d\u0440\u0438 \u0423\u0438\u043b\u043b\u043e\u0443\u0431\u0438 (Gary Willoughby) \u00ab<a href=\"http:\/\/nomad.so\/2015\/09\/working-with-files-in-the-d-programming-language\/\">Working with files in the D programming language<\/a>\u00bb, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0439 28 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2015 \u0433\u043e\u0434\u0430.<\/i><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u043c\u0435\u043d\u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0435\u043b\u044c \u043d\u0430\u0437\u0430\u0434 \u0438 \u043e\u0437\u0430\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f <a href=\"http:\/\/devdungeon.com\/content\/working-files-go\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 Go<\/a> (\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u2014 <i>\u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.<\/i>). \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u0432\u0442\u043e\u0440 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u044f\u0437\u044b\u043a\u0430 <a href=\"https:\/\/golang.org\/\">Go<\/a>. \u0418 \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u0442, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043e\u043f\u0438\u0441\u0430\u0432, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 \u044f\u0437\u044b\u043a\u0435 <a href=\"http:\/\/dlang.org\/\">D<\/a>.<\/p>\n<p>  \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043b\u044e\u0431\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0445\u043e\u0442\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u2014 \u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0435, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 D. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0438 \u043c\u043e\u0449\u044c \u044f\u0437\u044b\u043a\u0430 D \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438.<\/p>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0435\u0434\u0438\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (Uniform Function Call Syntax, UFCS). \u041f\u0443\u0441\u0442\u044c \u043e\u043d \u0432\u0430\u0441 \u043d\u0435 \u0441\u043c\u0443\u0449\u0430\u0435\u0442: \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0435\u0433\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"http:\/\/nomad.so\/2013\/08\/alternative-function-syntax-in-d\/\">\u0437\u0434\u0435\u0441\u044c<\/a> (<em>\u043f\u043e\u043a\u0430 \u0442\u043e\u0436\u0435 \u0430\u043d\u0433\u043b. \u2014 \u043f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.<\/em>).  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-267519","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=267519"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267519\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}