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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:09:04+00:00 2026-05-22T17:09:04+00:00

I have a file which first 64 bytes are: 0x00: 01 00 00 10

  • 0

I have a file which first 64 bytes are:

0x00:  01 00 00 10 00 00 00 20 00 00 FF 03 00 00 00 10  
0x10:  00 00 00 10 00 00 FF 03 00 00 00 10 00 00 FF 03  
0x20:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
0x30:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

When i’m reading the file (mode read and write) at position 26 for 4 bytes I get 0 and the next time (at position 30) i get correctly 4096.

The code is:

// read LastDirectoryBlockStartByte...
seekg(26);
char * pCUIBuffer = new char[4];
read(pCUIBuffer, 4);
const unsigned int x1 = gcount ();
const unsigned int LastDirectoryBlockStartByte = *(unsigned int *)pCUIBuffer;

// read LastDirectoryBlockNumberItems...
seekg(30);
read(pCUIBuffer, 4);
const unsigned int x2 = gcount ();
const unsigned int LastDirectoryBlockNumberItems = *(unsigned int *)pCUIBuffer;

With gcount() I checked the bytes are read – and this were correctly both times 4.
I have no idea to debug it.

———- EDIT ———-

When I use the following code (with some dummy before) it reads correctly:

char * pCUIBuffer = new char[4];
seekg(26);
read(pCUIBuffer, 4);
const unsigned int x1 = gcount ();
seekg(26);
read(pCUIBuffer, 4);
const unsigned int x2 = gcount ();
const unsigned int LastDirectoryBlockStartByte = *(unsigned int *)pCUIBuffer;

// read LastDirectoryBlockNumberItems...
seekg(30);
read(pCUIBuffer, 4);
const unsigned int x3 = gcount ();
const unsigned int LastDirectoryBlockNumberItems = *(unsigned int *)pCUIBuffer;

The difficulty is that the code stands at the begining in a methode. And the “false readed value” has obviously nothing to do with the listed code. Maybe theres a trick with flush or sync (but both I tryed…) or somewhat else…

  • 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-22T17:09:05+00:00Added an answer on May 22, 2026 at 5:09 pm

    Now I’m writing an answer, because my attempt to contact TonyK failes (I asked for writing an answer).

    The perfect answer to my question was to enable exceptions by calling exceptions (eofbit | failbit | badbit).

    Rumo

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

Sidebar

Related Questions

I have created a file argument.pl which takes several arguments first of which should
I have .zip file which contain csv data. I am reading .zip file using
I have got a file which is let's say 8 bytes length. For example
i want to read\write a binary file which has the following structure: The file
I have a csv-file which i want to transform with fmpp (freemarker). The first
I have a file which is an XML representation of some data that is
I have a file which has multiple columns, whitespace separated. e.g: data1 data2 data3
Assume you have a file which has been committed in your Git repo. You
I have one file in my project, (the readme file,) which I would like
I have an excel file which has more than 65536 rows. However, I can

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.