// http://www.cplusplus.com/reference/fstream/ofstream/open/ open file with append mode int logg = open ("log.txt", O_WRITE | O_APPEND, 0666); make server socket while (2 == 2) accept int pid = fork(); if (pid == -1) error death bad else if (pid == 0) // I am the child work die die die else // I am the parent do { int ret = waitpid(-1, &status, WNOHANG) } while (ret > 0); work: read parse write(logg, filename.c_str(), filename.length()); if not get error page add . to filename file = open(filename, O_RDONLY) if error erro page send meta loop len = read(file, buf, 999); write(client, buf, len); close everything exit