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 4271934
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:30:34+00:00 2026-05-21T07:30:34+00:00

Thank you everybody so far for your input and advice! Additionally: After testing and

  • 0

Thank you everybody so far for your input and advice!

Additionally:

After testing and toying further, it seems individual calls to FileReader succeed. But calling FileReader multiple times (these might be separate versions of FileReader) causes the issue to occur.

End Add

Hello,

I have a very unusual problem [please read this fully: it’s important] (Code::Blocks compiler, Windows Vista Home) [no replicable code] with the C File Reading functions (fread, fgetc). Now, normally, the File Reading functions load up the data correctly to a self-allocating and self-deallocating string (and it’s not the string’s issue), but this is where it gets bizarre (and where Quantum Physics fits in):

An error catching statement reports that EOF occurred too early (IE inside the comments section at the start of the text file it’s loading). Printing out the string [after it’s loaded] reports that indeed, it’s too short (24 chars) (but it has enough space to fit it [~400] and no allocation issues). The fgetc loop iterator reports it’s terminating at just 24 (the file is roughly 300 chars long) with an EOF: This is where it goes whacky:

Temporarily checking Read->_base reports the entire (~300) chars are loaded – no EOF at 24. Perplexed, [given it’s an fgetc loop] I added a printf to display each char [as a %d so I could spot the -1 EOF] at every step so I could see what it was doing, and modified it so it was a single char. It loops fine, reaching the ~300 mark instead of 24 – but freezes up randomly moments later. BUT, when I removed printf, it terminated at 24 again and got caught by the error-catching statement.

Summary:
So, basically: I have a bug that is affected by the ‘Observer Effect’ out of quantum physics: When I try to observe the chars I get from fgetc via printf, the problem (early EOF termination at 24) disappears, but when I stop viewing it, the error-catch statement reports early termination.

The more bizarre thing is, this isn’t the first time it’s occurred. Fread had a similar problem, and I was unable to figure out why, and replaced it with the fgetc loop.

[Code can’t really be supplied as the code base is 5 headers in size].

Snippet:

int X = 0; 
int C = 0; 
int I = 0;

while(Copy.Array[X] != EOF)
{
    //Copy.Array[X] = fgetc(Read);
    C = fgetc(Read);
    Copy.Array[X] = C;
    printf("%d %c\n",C,C); //Remove/add this as necessary
    if(C == EOF){break;}
    X++;
}

Side-Note: Breaking it down into the simplest format does not reproduce the error.

  • 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-05-21T07:30:35+00:00Added an answer on May 21, 2026 at 7:30 am

    You probably have some heap corruption going on. Without seeing code it’s impossible to say.

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

Sidebar

Related Questions

I now have it set up so that when people go to a thank
What is the SQL query to select all of the MSSQL Server's logins? Thank
SQL is not my forte, but I'm working on it - thank you for
Please let me know what architecture do VoIP applications use, P2P or Client-Server? Thank
thanks in advance for your help. I am wondering if there is a (design)
Hi everybody If someone search for term zali se mami in mySql database, what
Hey everybody, I'm very confused about how to use two different Cell Types in
Hi everybody I'm a beggining with extjs and I have issue with change /
thank you for you time in advance. Very new to MFC and attempting to
Thanks to a Q&A on stackoverflow. I just found out how to determine the

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.