473,395 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Is fopen blocked?

Hi guys,
I suddenly think about this question. While we use fopen() to open a
file and then do reading and writing. Is fopen a blocked function?

Regards!
Bo
Oct 13 '07 #1
6 2415
Bo Yang wrote:
Hi guys,
I suddenly think about this question. While we use fopen() to open a
file and then do reading and writing. Is fopen a blocked function?
What is a blocked function?

--
Ian Collins.
Oct 13 '07 #2
Ian Collins :
Bo Yang wrote:
>Hi guys,
I suddenly think about this question. While we use fopen() to open a
file and then do reading and writing. Is fopen a blocked function?
What is a blocked function?
I mean if there is soem other process is now using the file, how the
fopen will act? It fails directly or just waiting there to the process
which uses the file release the file?

Regards!
Bo
Oct 13 '07 #3
Bo Yang wrote:
Ian Collins :
>Bo Yang wrote:
>>Hi guys,
I suddenly think about this question. While we use fopen() to open a
file and then do reading and writing. Is fopen a blocked function?
What is a blocked function?
I mean if there is soem other process is now using the file, how the
fopen will act? It fails directly or just waiting there to the process
which uses the file release the file?
The standard doesn't say, why should there be a problem with more than
one process opening a file?

There may be platform dependent error returns if a file is exclusive.

--
Ian Collins.
Oct 13 '07 #4
Ian Collins :
Bo Yang wrote:
>Ian Collins :
>>Bo Yang wrote:
Hi guys,
I suddenly think about this question. While we use fopen() to open a
file and then do reading and writing. Is fopen a blocked function?

What is a blocked function?
I mean if there is soem other process is now using the file, how the
fopen will act? It fails directly or just waiting there to the process
which uses the file release the file?
The standard doesn't say, why should there be a problem with more than
one process opening a file?

There may be platform dependent error returns if a file is exclusive.
So, if there are many process want to do fopen("file","a"); . Are they
all success? Or there are some will failed?
Oct 13 '07 #5
Bo Yang wrote:
Ian Collins :
>Bo Yang wrote:
>>Ian Collins :
Bo Yang wrote:
Hi guys,
I suddenly think about this question. While we use fopen() to open a
file and then do reading and writing. Is fopen a blocked function?
>
What is a blocked function?

I mean if there is soem other process is now using the file, how the
fopen will act? It fails directly or just waiting there to the process
which uses the file release the file?
The standard doesn't say, why should there be a problem with more than
one process opening a file?

There may be platform dependent error returns if a file is exclusive.
So, if there are many process want to do fopen("file","a"); . Are they
all success? Or there are some will failed?
That depends on the platform and system specific things like file locks.

--
Ian Collins.
Oct 13 '07 #6
Bo Yang wrote:

I mean if there is soem other process is now using the file, how the
fopen will act? It fails directly or just waiting there to the
process which uses the file release the file?
As stated by the others, the Standard doesn't specify. Generally, they
will all be able to open. That's why most platforms provide some sort
of file-locking ability.


Brian
Oct 13 '07 #7

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

Similar topics

8
by: Jay Vinton | last post by:
I recently posted my first .aspx effort and am getting calls from users saying the page is being blocked and they can't view it. They got a hyperlink in an e-mail (see below). Most have been...
17
by: laurenq uantrell | last post by:
In master.dbo.sysprocesses I can filter for blocked users (Blocked >0) and I can create a self join(ON SPID = Blocked) to see what user Loginame is causing the block. In the column I can see the...
7
by: git_cs | last post by:
Hey, guys and gals Somedays ago, I had asked for the DES algorithm in C language. Although I have written the algorthim in C myself, I am facing a peculiar problem, which I hope some of u guys and...
13
by: Blue | last post by:
Hi , Can any one please let me explain me the diffrences between "open"/ "fopen" or "read"/"fread" or "write/fwrite". I know that "open" /"read" / "write" are system calls and "fopen"...
10
by: pjlsr | last post by:
It's close to twenty years since I used the C language and at that time I was doing only floating point computational work, nothing with strings or reading files. I tried to use fopen in the...
4
by: Dr. J | last post by:
How to terminate a blocked thread? In my form's "load" I launch a TCP listening thread that stays in an infinite loop waiting for incoming TCP packets. In this form's "closing" I try to...
10
by: Julia | last post by:
Hi, there, I am trying to append a binary file by using: FILE *strean; stream = fopen( "c:\temp.dat", "ba+" )); Is there a way that I can check if the file exists or not before fopen,...
4
by: dd | last post by:
I have a scenario where my popups are being blocked by IE6+ and Firefox. The problem is that although the popup is a direct result of the user clicking on the link (meaning that they WANT the...
5
by: Brian | last post by:
Hi I have a problem in opening url using 'file'. I searched many other discussion groups and tried suggestions, but could not resolve this problem. e.g <?php $myfile =...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...

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.