Hi
Does someone knows if fopen() is a non-blocking function in a sense
that if there isn't sufficient disk space to open a file in write mode,
then the function will not wait but fail?
I find it difficult to believe that anyone who use this function wants
the program to wait until disk space is enlarged 5 7407 ey*******@gmail.com wrote: Hi Does someone knows if fopen() is a non-blocking function in a sense that if there isn't sufficient disk space to open a file in write mode, then the function will not wait but fail?
It's entirely up to the implementation so check in a group dedicated to
your system. The C standard allows it to fail, but it does not give any
conditions under which it must fail rather than waiting.
I find it difficult to believe that anyone who use this function wants the program to wait until disk space is enlarged
I can think of times when you might possibly want that, but I agree that
it is not what one normally wants.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro: http://clc-wiki.net/wiki/Intro_to_clc ey*******@gmail.com wrote: Does someone knows if fopen() is a non-blocking function in a sense that if there isn't sufficient disk space to open a file in write mode, then the function will not wait but fail?
There's no way the Standard can forbid this and remain generally
applicable. Assume, for example, an implementation which will try to
open URLs as if they were normal files - not an unreasonable thing to
try under some circumstances. Assume that the computer this program runs
on is on dial-up. Assume also that the OS helpfully pops up a dialog for
the user to enter his dial-up password - and then hides it behind the
program's main window (Yes, Windows XP, that's you I'm looking at!). The
program will sit there, waiting for the internet connection to be made.
The user will sit there, waiting for the program to open the file.
They'll be staring at one another until the user notices that there's
one more program open all of a sudden and either enters his password
(fopen() returns a valid FILE pointer), or cancels the dialog (fopen()
returns a null pointer).
If that's too far-fetched (I don't think it is), consider an
implementation which fopen()s a file on a mounted networked disk - which
appears to the program as a perfectly normal file - and a user who has
forgotten his network password and goes off hunting for the Post-It.
I do not believe that the Standard could reasonably forbid either
scenario.
I find it difficult to believe that anyone who use this function wants the program to wait until disk space is enlarged
On a normal disk, no. But not all files are on normal, local disks.
Richard
<ey*******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com... Hi Does someone knows if fopen() is a non-blocking function in a sense that if there isn't sufficient disk space to open a file in write mode, then the function will not wait but fail?
As many others have said, the specification does not say..
I find it difficult to believe that anyone who use this function wants the program to wait until disk space is enlarged
But in a system where there is a Hierarchical (excuse spelling) file store
the system manager might want the program to wait until stuff is moved to
tape (or slower disk) to make room for your file. Or for read wait until it
is paged in for input
David Wade wrote: But in a system where there is a Hierarchical (excuse spelling) file store the system manager might want the program to wait until stuff is moved to tape (or slower disk) to make room for your file. Or for read wait until it is paged in for input
And in case anyone says that's sheer speculation, IIRC George 3 would
archive inactive files onto tape and reload them when they were opened.
(Well, it asked the operators to do the actual /loading/, but the point
is that opening a "disc" file might take a "long" time.)
--
Chris "CE !; AS *1 !; LF !; ER !; now run your program" Dollin
"Who do you serve, and who do you trust?"
In article <Qf********************@eclipse.net.uk>, "David Wade" <g8***@yahoo.com> writes: <ey*******@gmail.com> wrote in message news:11**********************@j33g2000cwa.googlegr oups.com...
I find it difficult to believe that anyone who use this function wants the program to wait until disk space is enlarged
But in a system where there is a Hierarchical (excuse spelling) file store the system manager might want the program to wait until stuff is moved to tape (or slower disk) to make room for your file.
And in a batch processing environment, an implementation could
sensibly have such an fopen cause the program to be suspended until
an operator intervenes. That's typical behavior for exceptional
conditions in batch processing.
Not all the world is interactive computing.
--
Michael Wojcik mi************@microfocus.com
Not the author (with K.Ravichandran and T.Rick Fletcher) of "Mode specific
chemistry of HS + N{_2}O(n,1,0) using stimulated Raman excitation". This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Grocery Clerk |
last post by:
I know open() returns a file descriptor and fopen() returns a pointer
to FILE. The question is, when do I use fopen() and when do I use
open()? Could someone give me an example when to use one...
|
by: Sathyaish |
last post by:
If fopen fails, is there a way to know why?
|
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"...
|
by: lihua |
last post by:
Hi, Group!
I got one question here:
We all know that fclose() must be called after file operations to
avoid unexpected errors.But there are really cases when you forget to
do that!Just
like...
|
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...
|
by: ferrad |
last post by:
I am trying to open a file for appending. ie. if the file exists, open
it for appending, if not, create it. I am getting back a NULL pointer,
and do not know why. Here is my code:
FILE...
|
by: David Mathog |
last post by:
A program of mine writes to a tape unit. Output can be either through
stdout or through a file opened with fopen(). When all the data is
transferred to tape the program needs to close the output...
|
by: subramanian100in |
last post by:
Consider the following program:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{
if (argc != 2)
{
printf("Usage: <program-name<text-file>\n");
|
by: Bill Cunningham |
last post by:
I have a question about fopen. I want to append text to a text file
already written. I think this is what I need to do. If I am correct fopen's
second parameter takes only 2 letters. I am using wt....
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |