Sign in to follow this  
nuclear123

convert char* to DWORD?

Recommended Posts

[code]


char *string1 = "hithere";

void function(DWORD dwAddy)
{
.
.
}


int main()
{

function( string1 );

return 0;
}[/code]


how do i pass the address of my hardcoded string( "hithere" ) into my function and store the address in a DWORD( int ) ? thanks

Share this post


Link to post
Share on other sites
how many bits are in your address? 32? and in DWORD? 32? then you can just cast it:

function( (DWORD)string1 );

whether this is 'safe' or 'correct' or 'best practice' can be the subject of discussion...

Share this post


Link to post
Share on other sites
1 more thing, how do i get visual studio to print me the pointer value of the following?

(*((BYTE*)(dwAddress+i))) ) <---- visual studio will let me breakpoint and hover mouse over variable "dwaddress" and get it's current contents because it's a variable. But how do i make visual studio tell me the value of the casted pointer "(*((BYTE*)(dwAddress+i))) )" when i mouse over it doesnt give me options to view the dereferenced pointer value? how do i make it show me?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this