file access

B

Basti

Hello,

currently i'm writing a programm for a multi-user system. My problem
is, that i don't know what happens if two or more users use the file
for writing at the same time. Is the file locked if a user does a
write access or do I have to lock the file manually. I'm using fopen
to open a file and fputs to write to te file. Thanks for the
suggestions.

Greets
 
C

Christopher Benson-Manica

Basti said:
currently i'm writing a programm for a multi-user system. My problem
is, that i don't know what happens if two or more users use the file
for writing at the same time. Is the file locked if a user does a
write access or do I have to lock the file manually. I'm using fopen
to open a file and fputs to write to te file. Thanks for the
suggestions.

(It all depends on what OS the system runs, how the users open the
file, and possibly many other variables. It may well be locked, but
it's probably unwise take that on faith.)

Your post is off-topic for comp.lang.c. Please visit

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.
 
D

Darrell Grainger

Hello,

currently i'm writing a programm for a multi-user system. My problem
is, that i don't know what happens if two or more users use the file
for writing at the same time. Is the file locked if a user does a
write access or do I have to lock the file manually. I'm using fopen
to open a file and fputs to write to te file. Thanks for the
suggestions.

This is an OS question. Nothing in the C standard defines this. So, you'll
have to ask a newsgroup that knows your OS. It might even be configurable
by the admin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top