Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:47:17+00:00 2026-06-04T09:47:17+00:00

In my software I have to read multiple txt databases in a serial way,

  • 0

In my software I have to read multiple txt databases in a serial way, so I read the first, then I do something with the info I got from that file, than I open another one to write and so on.

Sometimes I got an error on an opening OR creation of a file, and then I got errors on all the following opening/creation, which uses different functions, different variables, different files.

So for example I call the function below, which uses two files, and I got an error “* error while opening file -%s- ..\n”, then all the other fopen() in my code goes wrong!

This is an example of code for one single file:

FILE *filea;
if((filea=fopen(databaseTmp, "rb"))==NULL) {
    printf("* error while opening file -%s- ..\n",databaseTmp);
    fclose (filea);
    printf("---------- createDatabaseBackup ----------\n");
    return -1;
}
int emptyFolder=1;
FILE *fileb;
if((fileb=fopen(databaseBackup, "ab"))==NULL) {
    printf("* error while opening file -%s- ..\n",databaseBackup);
    fclose (fileb);
    printf("---------- createDatabaseBackup ----------\n");
    return -1;
}
else {
    int i=0;
    char c[500]="";
    for (i=0;fgets(c,500,filea);i++) {
        fprintf(fileb,"%s",c);
        emptyFolder=0;
    }
} 
fclose(fileb);
fclose(filea);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:47:18+00:00Added an answer on June 4, 2026 at 9:47 am
    1. There is an upper limit on the number of open handles for a given process. May be you have a handle leak in your program ?

    2. Error while creating a file typically means you don’t have access permission to the parent folder .

    3. Those error log messages belong to your program . You can enhance it further. There is an errnum set by the os as fopen is essentially a system call. You can print that error number and get more info about your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a software renderer that I am porting from PC to the iPhone.
I am new to OOP in PHP (normally write software). I have read that
We have a software that reads data from other third party websites, so far
We have software that runs fine under a normal Windows installation but when we
We have this software that has a webservices component. Now, the administrator of this
I have a software that runs on mac (using terminal program) the program is
I have some software written in VB.NET that performs a lot of calculations, mostly
Hi I have some software written in VB6.0 that uses an SQL Server, but
My software uses multiple threads to do its work. There is a pipeline that
I currently have a small Python script that I'm using to spawn multiple executables,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.