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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:21:38+00:00 2026-05-13T15:21:38+00:00

How to convert __int64 to long in Windows (MSVC8 & MSVC6)? Will a normal

  • 0

How to convert __int64 to long in Windows (MSVC8 & MSVC6)?

Will a normal typecasting work?

Also, how about converting long to __int64? If the long is a negative value, will it work?

Note – I am talking of a scenario in which the __int64 variable will always contain a value which will not be more than 32 bits long.

  • 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-13T15:21:38+00:00Added an answer on May 13, 2026 at 3:21 pm

    1. Convert long to __int64

    Acorrding to MSDN on the __int64 keyword:

    The _ _int64 keyword declares a new
    type, a 64-bit (8-byte) integer. As
    with the int, short, and long types,
    the _ _int64 type has a corresponding
    unsigned version, so the _ _int64
    keyword actually can be used to create
    two types.

    The following code sample shows how to
    declare two 64-bit integers, one
    signed and the other unsigned:

    __int64 signed_big_int; unsigned __int64 unsigned_big_int;

    __int64 is signed,and it should be wider than long.So you could assign long to __int64 without even a type cast and of course the signed __int64 support negative long.

    2. Convert __int64 to long

    It is OK to convert __int64 to long,only with possibility of loosing data.My msvc8 only warn me of the pssibility of loss of data.

    3. Note:

    C99 defined a standard 64-bit integer type named int64_t and unsigned version uint64_t in stdint.h.If you want to provide portable code, you should use them but not __int64.

    Notice there is no standard 64-bit integer type in C++ programming language,MSVC use __int64,but in linux world you normally use int64_t or uint64_t which is type defined as long long or unsigned long long in C99’s stdint.h.Here I assume your C++ compiler support the stdint.h header file.

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

Sidebar

Ask A Question

Stats

  • Questions 307k
  • Answers 307k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Convert the tv_sec using localtime, and strftime, then append tv_usec… May 13, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer Try adding the redirect flag: RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page=$2 [R=301, L] May 13, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer It's easy enough to accomplish half of the necessary functionality.… May 13, 2026 at 9:31 pm

Related Questions

I'm writing c/c++ code on Windows using Visual Studio. I want to know how
Consider the following sample code: class SampleClass { public long SomeProperty { get; set;
I need help with my code. I would like to write only numbers/integers in
I am getting a string from HttpContext.Current.Request[key] which i then do split(',') if its
I have a date value, which I'm told is 8 bytes, a single long

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.