473,473 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Opening files in "exclusive mode"?

Hi everyone...

I'm trying to open a text file in exclusive mode (meaning I want to
lock out any other processes from accessing the file while I'm working with
it).

Here's my code:

ifstream fs_infile("field_summary.dat", filebuf::sh_none)

And I get the following error:

'sh_none' is not a member of type 'filebuf'

What am I doing wrong? Is this the right way to do this? Or is
there a better way to do this file locking?

Thanks in advance...

Dave Reid
Jul 23 '05 #1
2 5735
Dave Reid wrote:
Hi everyone...

I'm trying to open a text file in exclusive mode (meaning I want to
lock out any other processes from accessing the file while I'm working with
it).

Here's my code:

ifstream fs_infile("field_summary.dat", filebuf::sh_none)

And I get the following error:

'sh_none' is not a member of type 'filebuf'

What am I doing wrong? Is this the right way to do this? Or is
there a better way to do this file locking?

Thanks in advance...


Your compiler is right. 'sh_none' is not a member of type filebuf.
Opening a file in "exclusive mode" is likely OS-specific. Perhaps you
could ask about it in a newsgroup dedicated to your OS.

Kristo

Jul 23 '05 #2
> I'm trying to open a text file in exclusive mode (meaning I want to
lock out any other processes from accessing the file while I'm working
with
it).


No such thing according standard C++.

You want to poke around your compilers documentation and see if they provide
an extension or a means by which you can open in excusive mode.

And/Or post something to your compiler-vendors newsgroups or mailing list.
comp.lang.c++ is no good for this.

Stephen Howe
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kent P. Iler | last post by:
Hi, I have an application that watches a directory using FileSystemWatcher. When a specific type of files comes over, I want to parse it and then move it. However, these files can be somewhat...
21
by: nicholas | last post by:
Although in my web.config I have <customErrors mode="off" /> I still get no detailed errors. How comes ? THX This is what I get: Server Error in '/mywebfolder'Application.
5
by: Savas Ates | last post by:
I have a web application It works well in my local folder.. When i upload it to my web server i got To enable the details of this specific error message to be viewable on remote machines,...
2
by: Tor Inge Rislaa | last post by:
I am prompted to implement the syntax below to be able to monitor the error on the remote server trough my browser (client). I can't seem to find where to place the code in my web.config file to...
35
by: kaleolani65 | last post by:
I recently started a job at a medical staffing company, a database used to keep information was built by a lady there who has very limited Access experience (even less than me) They run...
17
by: teddysnips | last post by:
One of my clients has asked me to make a change to one of their Access applications. The application is a Front End/Back End standard app. I didn't develop it, but looking at it tells me that...
10
by: albert.neu | last post by:
To what extent does Microsoft Visual C++ also called: VC++ also called: Microsoft (R) 32-bit C/C++ Optimizing Compiler support C99? VC++ compiles either in C mode (which is def. *not*...
4
by: wilderness | last post by:
I have a Windows 2000 Server (SP4) with .NET Framework 1.1 (with hotfixes) installed, along with .NET Framework 2 I have a Delphi .DLL that interfaces with several .aspx files as part of a member...
15
denny1824
by: denny1824 | last post by:
I have a working website. I copied all the files to a new folder in inetpub/wwwroot and then set that folder as a Virtual Directory in IIS. I try going to that site from the new folder and i am...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.