From owner-freebsd-questions Sun Aug 12 4:45:54 2001 Delivered-To: freebsd-questions@freebsd.org Received: from gamma.root-servers.ch (gamma.root-servers.ch [195.49.62.126]) by hub.freebsd.org (Postfix) with SMTP id F0E9F37B409 for ; Sun, 12 Aug 2001 04:45:38 -0700 (PDT) (envelope-from gabriel_ambuehl@buz.ch) Received: (qmail 20363 invoked from network); 12 Aug 2001 11:45:37 -0000 Received: from dclient217-162-128-224.hispeed.ch (HELO athlon550) (217.162.128.224) by 0 with SMTP; 12 Aug 2001 11:45:37 -0000 Date: Sun, 12 Aug 2001 13:48:15 +0200 From: Gabriel Ambuehl X-Mailer: The Bat! (v1.53bis) Educational Organization: BUZ Internet Services X-Priority: 3 (Normal) Message-ID: <94356165699.20010812134815@buz.ch> To: freebsd-questions@freebsd.org Subject: write() failing.. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hello, I've there got a problem with write() which is failing for a reason I can't figure out: #include #include #include #include //C++ STL #include #include class class_logfiles { private: map files; public: int write_to_log(const string &logfile_path, const string &message); //class_logfiles(void): default constructor }; int class_logfiles::write_to_log(const string &logfile_path, const string &message) { map::iterator miter; miter = this->files.find(logfile_path); if(miter == this->files.end()) // there isn't any open logfile with logfile_path { int current_des; current_des=open((const char *) logfile_path.c_str(), O_APPEND | O_CREAT | O_EXLOCK | O_NOFOLLOW); cout << "current_des " << current_des << " errno " << errno << " path " << logfile_path.c_str()<< endl; this->files[logfile_path]=current_des; cout << "write exit status: " << write(current_des, message.data(), message.size()) << flush; cout << " errno: " << errno << " des " << current_des <