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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:45:20+00:00 2026-06-17T13:45:20+00:00

I asked a similar question some weeks ago, but I got stuck, and didn’t

  • 0

I asked a similar question some weeks ago, but I got stuck, and didn’t really know if I didn’t make any other mistakes.

I can relatively clearly tell what I am fighting with now.

I am trying re-write a VB6 function in C++.
The difficult line is this one:

vector<int>vIntegerValues;

vIntegerValues.resize(iCountIntegers);

fseek(iReadFile, uFromBytePos * sizeof(int), SEEK_CUR);

size_t readElements = fread(&vIntegerValues[0], sizeof(int), iCountIntegers, iReadFile); 

My VB6 version is this:

Dim vIntegerValues() As Integer

ReDim vIntegerValues(0 To iCountIntegers)

Get #iReadFile, uFromBytePos, vIntegerValues()

However the C++ function fills up the integer vector with data that is not as expected.

For example in VB6 the first values are:
0,0,2,2,0,-2,0,-2,0,2,0,0,-2,

And in C++ the first values are
131074, -131072, -131072, 131072, 0, 65534

Can somebody help when he sees where I go wrong?
Thank you very much.

ps: I don’t know in advance what the size of the vector vIntegerValues will be, so please do not suggest anything with a fixed vector. This is where I would get stuck.

  • 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-17T13:45:21+00:00Added an answer on June 17, 2026 at 1:45 pm

    Your VB6 Integers are 16-bit words. Use int16_t (or short int on some platforms, including yours 🙂 to get the same thing in C++.

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

Sidebar

Related Questions

I asked a similar question a while ago but I didn't know very much,
I know similar question has been asked but i didn't found proper answer to
I asked similar question before and got some nice code, but i'm concerned with
I asked a very similar question not too long ago and got some great
I asked a similar question before, and got some good answers, but I think
I have asked a similar question some days ago, but I have yet to
I asked some similar questions [1, 2] yesterday and got great answers, but I
Somebody asked similar question not long ago. But nobody answered comprehensively. Assume I have:
I asked a similar question a couple of days ago, but I'm looking for
I asked similar question sometime ago, but I am making new one to be

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.