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

  • Home
  • SEARCH
  • 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 6474785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:37:44+00:00 2026-05-25T06:37:44+00:00

I have stumbled across a problem where I am attempting to read in a

  • 0

I have stumbled across a problem where I am attempting to read in a file, which is, according to windows, ‘87.1 kb’ in size, and using the ftell method in program, returns ‘89282’, effectively confirming what windows is saying.

So why is every method to read chars from the file only returning 173 or 174 characters?

The file is a .GIF file renamed to .txt (and I am trying to build a program that can load the data fully as I am working on a program to download online images and need to run comparisons on them).

So far I have tried:

  • fgetc – This returns 173/174 chars.
  • fread – Same as above, this is with a string with 1024 or more spaces available.
  • fgets – Doesn’t work (as it doesn’t return how many characters it has read – characters which include nulls).
  • setvbuf – Disabling this with _IONBF, or even supplying a buffer of 1024 or more only means 173/174 is still returned.
  • fflush – This produced a ‘result’, although a negative one – it returned ‘2’ chars instead of ‘173’.

I am utterly stumped as to why it isn’t reading anything more than 173/174 chars. Is there something I need to compensate for or expect at the lower level? Some buffer I need to expand or some weird character I need to look out for?

  • 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-25T06:37:44+00:00Added an answer on May 25, 2026 at 6:37 am

    Here’s one thing to look at. Have a look at the file in a hex viewer and see if there’s a CTRL-Z somewhere around that 173/174 offset.

    Then check to see if you’re opening it with the "r" mode.

    If so, it may be that the Windows translation between text and binary is stopping your reading there because CTRL-Z is an EOF marker in text mode. If so, you can probably fix this with "rb" mode on the fopen.

    Failing that, you need to post the smallest code segment that exhibits the problem behaviour. It may be obvious to some of us here but only usually if we can see the code 🙂

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

Sidebar

Related Questions

I'm trying out ASP.NET MVC routing and have of course stumbled across a problem.
I'm quite new to hibernate and have stumbled on this problem, which I can't
While developing a design using jQuery I stumbled across a problem. How would I
I am using iframes in my page, and have stumbled across a weird issue.
I have some code that parses through an html file and I stumbled across
I have stumbled across the following issue: Using IIS6, I was trying to run
I'm trying to truncate some text in PHP and have stumbled across this method
I've been practicing for an upcoming programming competition and I have stumbled across a
I'm revisiting som old code of mine and have stumbled upon a method for
I have recently stumbled upon a problem with selecting relationship details from a 1

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.