MESSAGE
DATE | 2011-06-07 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: C++ File Lokcing
|
-- forwarded message -- Path: reader1.panix.com!panix!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news-2.dfn.de!news.dfn.de!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Victor Bazarov Newsgroups: comp.lang.c++ Subject: Re: C++ File Lokcing Date: Tue, 07 Jun 2011 14:23:13 -0400 Organization: A noiseless patient Spider Lines: 40 Message-ID: References: <9559f9Fh2bU1-at-mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 7 Jun 2011 18:23:15 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="mfoyPVXLF0MtM1ZkAsRgyQ"; logging-data="27219"; mail-complaints-to="abuse-at-eternal-september.org"; posting-account="U2FsdGVkX18LenXM4zIDGl3sGR6fQNIrtNJ6l7/Yd24=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:PddFPx8hKPdsiEvC31BeIPGKdjQ= Xref: panix comp.lang.c++:1086201
On 6/7/2011 2:17 PM, Ruben Safir wrote: > On Tue, 07 Jun 2011 11:55:36 -0400, Victor Bazarov wrote: > >> On 6/7/2011 11:54 AM, ruben safir wrote: >>> On 06/07/2011 02:33 AM, Stefan Ram wrote: >>>> "osmium" writes: >>>>> "ruben safir" wrote: >>>>>> Is there a C++ specific means of file locking? >>>>> No. File locking is provided by the operating system, not an ordinary >>>>> user >>>>> program, which is what a C++ compiler produces. >>>> >>>> This must be the correct answer, because Linus Torvalds also says that >>>> a C++ compiler cannot produce an operating system! >>>> >>>> (The real reason is - of coures - just that the C++ standard library >>>> does not provide this feature, but this might change in the future.) >>>> >>>> >>> >>> I have to do file locking on Linux. Do you have a recommendation? >> >> How about news:comp.os.linux.development.apps ? >> >> V > > But Victor, if you can't file lock with posix file locking, then there is > almost no use of ios_base for file systems. You have to lock files on a > multiuser OS before you write to them. Can you get the file descriptor > from ofsream or can you feed flock()?
But Ruben, there is no such thing in C++ as "file descriptor". POSIX and C++ are orthogonal, not part of each other. On some systems there *may* be a way to get something from 'std::ios_base' other than what the Standard specifies, but it's *not* specified by the Standard, and that's why you need to *ask elsewhere*. Can you not see that?
V -- I do not respond to top-posted replies, please don't ask -- end of forwarded message --
|
|