Hi,
How do I interpret errno from fopen()? errno = 24 in my case.
Thanks for any help,
Michael 6 20209
Hi,
I figured this out. errno = 24 means too many files open. Where can I
find documentation on errno values? I could not find it in
Harbison/Steele.
Michael
>How do I interpret errno from fopen()? errno = 24 in my case.
On my system (FreeBSD), that error code is 'too many open files'.
In programs, it's more friendly to call strerror(errno) and print
the string in an error message, or use perror(), than to print errno
in decimal.
Other ways to look up error codes include reading the <errno.h>
header file (on systems where it really is a file; it doesn't have
to be) and running "man errno".
Note that your error code refers to hitting a *per process* open
file limit, not a *system wide* open file limit. Do you keep opening
files and forget to close them ("file descriptor leak")? The
stingiest system I've seen with open files per-process allows 20
(including stdin, stdout, and stderr) and some allow a few thousand,
although if very many tried that, they'd hit the system-wide limit.
Gordon L. Burditt
"Michael McGarry" <mi************ *@gmail.com> writes: I figured this out. errno = 24 means too many files open. Where can I find documentation on errno values? I could not find it in Harbison/Steele.
The values of errno vary from system to system.
Use strerror() or perror().
--
Just another C hacker.
"Michael McGarry" <mi************ *@gmail.com> wrote:
# Hi,
#
# How do I interpret errno from fopen()? errno = 24 in my case.
Does perror give a meaningful message? You might see if error
numbers are listed in errno.h. On Unix, you can do
man 2 intro
....
24 EMFILE Too many open files. <As released, the limit on the number of
open files per process is 64.> Getdtablesize(2 ) will obtain the
current limit.
....
--
SM Ryan http://www.rawbw.com/~wyrmwif/
Don't say anything. Especially you.
Michael McGarry wrote: Hi,
I figured this out. errno = 24 means too many files open. Where can I find documentation on errno values? I could not find it in Harbison/Steele.
The only place is in documentation covering your specific system, and we
don't cover system specifics here. You may however find the standard
functions perror and strerror of use since they will allow you to output
in the manner of your choosing an error message that expands on the
value of errno.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
It was a case of file descriptor leak.
I will use strerror to get the error message.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Aaron Couts |
last post by:
I have a program that writes to a log file. It's compiled on RH Linux 7.3
(Kernel 2.4.18-18.7). It's using fopen in append mode. When the file reaches
51200000 bytes in size, the program will no longer write to the file. When
this happens, fopen and fputs do not return an error. I've been researching
large file support for Linux, and it all has to do with the regular 2-gig file
size limit. If it's something obvious, sorry -- I'm a C...
|
by: Sathyaish |
last post by:
If fopen fails, is there a way to know why?
|
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 *pFile;
char *cFileName;
cFileName=argv;
pFile = fopen(cFileName,"a+");
cFileName has a valid filename ('apm.dbg'), and I have full write
|
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: VijaKhara |
last post by:
Hi all,
Please tell me how to create a file (using fopen) in a sub-folder
(such as sub-folder "Mygoal")? I tried
if ( ( fp = fopen ( "mygoal\myfile.tif", "wb" ) ) == NULL ) {
fprintf ( stderr, "cannot open file %s\n");
exit ( 1 );
}
| |
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |