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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:36:03+00:00 2026-06-11T18:36:03+00:00

Having been told by most of the savvy students around campus here, binary file

  • 0

Having been told by most of the savvy students around campus here, binary file i/o is always faster than formatted i/o. After a bit of googling, i determined that the most efficient way of accomplishing binary i/o was not by streaming directly from the file, each value at a time, but by reading in a large chunk of data, like 4k or 8k chunks, and then parse the data out of that buffer. my question is, say that i used fstream to grab a chunk of data out of a file and stored it into a char array of 8192 bytes. now let’s say that it had a header of about 30 bytes, and then all the data after that were like 72 byte stuctures apiece. This would leave 56 bytes of incomplete data at the end which i couldn’t read into a structure. How do i handle this to maximize efficiency (yes, using c++ streams, please no whining about c++ streams here, i’ve heard dozens of arguments on it. This is wholly a question on binary i/o and NOT the efficacy of specific mediums of i/o please). Do i just leave that 56 bytes at the end unused, or do i try to frankenstein together the tail-end and first 16 bytes of the next buffer, or is there still another way to approach this? My question is also, WHY is reading chunks into a buffer like this before parsing, faster? Conversely, if you do not believe this is true, then please explain why if you can. Thanks for your time.

  • 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-11T18:36:04+00:00Added an answer on June 11, 2026 at 6:36 pm

    Use the standard iostream library, it performs buffering automatically.

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

Sidebar

Related Questions

I have been told its better to bind events to elements rather than having
I'm trying to use MVC for a new project after having been around the
I've been told that I'd be better using PDO for MySQL escaping, rather than
So I've always been told that it's bad practice to modify arguments to methods
Having been an imperative developer for some years now, I had never had the
Having been spoiled by ruby for so long, I now find myself having to
Having been given the all clear to move code from my Page_Loaded method to
I have been struggling with this for quite some time having been accustomed to
Been having some trouble implementing a single-column index in LaTeX. I've been employing the
I have been having trouble pulling up a custom UIPickerView from the textfield's inputview

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.