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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:13:41+00:00 2026-06-02T11:13:41+00:00

If the file is .c MSVC will compile. If it’s .cpp it cannot convert

  • 0

If the file is .c MSVC will compile.

If it’s .cpp it "cannot convert from 'void *' to 'unsigned char *'"

I’m using the MEMORY_BASIC_INFORMATION::BaseAddress in windows.h which is void*, assigning it to a char* so I can see the actual address you know?

When I cast it to char*, and later back to void* (to use it in windows functions), it like bugs out and loses data or something

What to do?

  • 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-02T11:13:43+00:00Added an answer on June 2, 2026 at 11:13 am

    In C++, you must use an explicit cast to convert a void* to anything else:

    void *vp;
    unsigned char *cp = static_cast<unsigned char *>(vp);
    

    This is indeed different from the situation in C, where a void* can be implicitly converted to any other pointer type. The reverse situation is still as in C:

    void *vp = cp;  // no need for a static_cast
    

    However, I don’t see why you’d need a char* to “see the actual address” as a void* can be printed as-is by operator<< on std::ostream and by std::printf with %p.

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

Sidebar

Related Questions

The following source file will not compile with the MSVC compiler (v15.00.30729.01): /* stest.c
FILE *out=fopen64(text.txt,w+); unsigned int write; char *outbuf=new char[write]; //fill outbuf printf(%i\n,ftello64(out)); fwrite(outbuf,sizeof(char),write,out); printf(%i\n,write); printf(%i\n,ftello64(out));
How can I create a MSVC solution from a Google GYP File? There seems
I'm tyring to convert a MSVC project from VS 2005 to VS 2008. It
Normally in MATLAB I can compile a mex file which uses OpenCV functions using:
I have a file structure like this: file1.h extern const char *build_info[][3]; file1.cpp #include
Is it possible to autogenerate a MSVC import library (LIB-file) from a DLL? How?
When I open a .cpp file separate of any project in MSVC, the debugging
I want to use MSVC compiler to build a DLL file. The problem is
file.txt contains: ##w## ##wew## using mac 10.6, bash shell, the command: cat file.txt |

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.