{"id":216,"date":"2012-04-26T14:11:41","date_gmt":"2012-04-26T13:11:41","guid":{"rendered":"http:\/\/csipet.web.elte.hu\/?p=216"},"modified":"2012-04-26T14:11:41","modified_gmt":"2012-04-26T13:11:41","slug":"11-ora","status":"publish","type":"post","link":"https:\/\/peter.csonka.hu\/hu\/blog\/2012\/04\/11-ora\/","title":{"rendered":"11. \u00f3ra"},"content":{"rendered":"<p><a href=\"https:\/\/docs.google.com\/document\/d\/1SivPVqXB9kCiKycBCkvScJMFX84xeHjVY0WMqkMNjxs\/edit\">https:\/\/docs.google.com\/document\/d\/1SivPVqXB9kCiKycBCkvScJMFX84xeHjVY0WMqkMNjxs\/edit<\/a><\/p>\n<pre lang=\"c\" line=\"1\">\n\/****************************************************************\n *\n * Purpose: Basic example of pipe. \n *          Read and write fixed length records across a pipe.\n *          This is about a simple as they come...\n *\n ******************************************************************\/\n\n#include <sys\/types.h>\n#include <unistd.h>\t\t\t\/* pipe.\t\t*\/\n#include <signal.h>\n\nvoid Child  (int Handle);\nvoid Parent (int Handle);\n\nvoid main()\n{\n\n  pid_t\t\tPid;\n  int \t\tfd[2];\n\n  pipe(fd);\t\t\t\t\/* Create two file descriptors \t*\/\n\n  Pid = fork();\n\n  if ( Pid == 0)\t\t\t\/* Child\t\t\t*\/\n  {\n    close(fd[0]);\n    Child(fd[1]);\n    puts(\"Child end\");\n  }\n  else\t\t\t\t\t\/* Parent.\t\t\t*\/\n  {\n    close(fd[1]);\n    Parent(fd[0]);\n    puts(\"Parent end\");\n  }\n}\n\n\/****************************************************************\n *\n *      The Child sends data to the parent.\n *\n ****************************************************************\/\n\nvoid Child(int Handle)\n{\n  char Buff[]=\"Martin 1 abcdefghijklmnop \";\n\n  write(Handle, Buff, strlen(Buff)+1);\n\n  Buff[7] = '2';\n  write(Handle, Buff, strlen(Buff)+1);\n\n  Buff[7] = '3';\n  write(Handle, Buff, strlen(Buff)+1);\n\n  Buff[7] = '4';\n  write(Handle, Buff, strlen(Buff)+1);  \n  \n  close(Handle);\n}\n\n\/****************************************************************\n *\n *      Read the data sent by the child.\n *\n ****************************************************************\/\n\n\nvoid Parent(int Handle)\n{\n\n  char Buff[50];\n  \/* ...\tRead EXACTLY the number of bytes sent. \n     ...\t0 is returned when the pipe is closed by the child. *\/\n\n  while (read(Handle,Buff, 27) > 0)\n  {\n    printf(\"%sn\", Buff);\n  }\n      \n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/docs.google.com\/document\/d\/1SivPVqXB9kCiKycBCkvScJMFX84xeHjVY0WMqkMNjxs\/edit \/**************************************************************** * * Purpose: Basic example of pipe. * Read and write fixed length records across a pipe. * This is about a simple as they come&#8230; * ******************************************************************\/ #include #include \/* pipe. *\/ #include void Child (int Handle); void Parent (int Handle); void main() { pid_t Pid; int fd[2]; pipe(fd); \/* Create two file descriptors *\/ Pid = fork(); if ( Pid == 0) \/* Child *\/ { close(fd[0]); Child(fd[1]); puts(&#8222;Child end&#8221;); } else \/* Parent. *\/ { close(fd[1]); Parent(fd[0]); puts(&#8222;Parent end&#8221;); } } \/**************************************************************** * * The Child sends data to the parent. * ****************************************************************\/ void Child(int&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-216","post","type-post","status-publish","format-standard","hentry","category-szamitogepes-alapismeretek-2"],"_links":{"self":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/posts\/216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":0,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/posts\/216\/revisions"}],"wp:attachment":[{"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/media?parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/categories?post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peter.csonka.hu\/hu\/wp-json\/wp\/v2\/tags?post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}