HelpConverting a String containing a Memory Address to Integer

Posts 1–15 of 20 · Page 1 of 2
Converting a String containing a Memory Address to Integer
Hey guys,

im starting to freak out about this problem. All i want is to write a simple c# program that lets you enter a memory address in a textbox and then displays it value. But the problem is that the address has to be an Integer, but i just can't convert a string from a textbox like 1DBD448 (or 0x1DBD448) to an Integer using int.Parse or Convert.ToInt32, that just gives me an error.

Any idea on how to do this?

Many thanks in advance!
Sorcer


Soo, if i understand your problem right, you try to output a value of an adress in a textbox ?

I remember that there is a C# function int32.tostring or something like this. Not sure if thats the answer you´re looking for....


cheers =)
This is why I hate C#...so damn complicated....
Code:
printf("Value @ 0xFFEFFE00 is %i", *(int*)0xFFEFFE00);
No, I just want to create a program where i can enter an address in a textfield and then it gives me the value of that address. It is nearly completed, but all I need is a working method to convert the string to an integer. As i already said, int.Parse and Convert.ToInt32 don't work because the address contains letters...
Quote Originally Posted by x2Sorcer View Post
No, I just want to create a program where i can enter an address in a textfield and then it gives me the value of that address. It is nearly completed, but all I need is a working method to convert the string to an integer. As i already said, int.Parse and Convert.ToInt32 don't work because the address contains letters...
That sounds as an good program!
Quote Originally Posted by x2Sorcer View Post
No, I just want to create a program where i can enter an address in a textfield and then it gives me the value of that address. It is nearly completed, but all I need is a working method to convert the string to an integer. As i already said, int.Parse and Convert.ToInt32 don't work because the address contains letters...
Your making your own Cheat Engine??
You could try this and see if it works:
Code:
string S = "1384"

int Value = *(int*)&S;
Nope, gives me two errors. Other ideas?
Quote Originally Posted by x2Sorcer View Post
Nope, gives me two errors. Other ideas?
What errors? Because It compiles for me...
Quote Originally Posted by Kenshin13 View Post
What errors? Because It compiles for me...
Im translating them now because im using a non-english interface:

1. It's not possible to declare a cursor for the executed type ("string") or to fetch its address or size.
2. Cursor and Buffer with fixed size can only be used in a unsafe context.

I think the "&S" in your code should be only "S", and if I change that, the first errors disappers, but instead I get:

Converting from "string" to "int*" is not possible.

Any ideas?
Well I know in c++ you could do thisWorks perfectly)
Code:
std::string MyString = "1945";
printf("Value of MyString to Integer-> %d \n", atoi(MyString.c_str());
getchar();
And the output is:
Code:
Value of MyString to Integer-> 1945
Try DllImport with the atoi function.

Also post the part that's giving errors for you. int.Parse() is supposed to work... Have you tried BitConverter.GetBytes()?
Why should GetBytes help here? It just converts booleans to the Bytes, doesn't it?
The part that gives errors is this line: int Value = *(int*)&S;.

And can you explain the atoi-thingy? Never used that before...

Thanks
atoi converts a string to an integer, just like atol converts it to a long value.
And the GetBytes will read the string and convert it to bytes...Booleans only have 1 or 0 so what you said didn't make sense...
You can convert an integer in a string to bytes then the bytes back to an integer if the int.Parse never worked.
Google is so good.
And even more when you know what you are to do

Code:
 int MyHex = int.Parse("012ABC", System.Globalization.NumberStyles.HexNumber);
Oh thank you so much. Was trying to solve that problem the whole day and even googled for over an hour but couldn't find something helpful

---------- Post added at 12:44 AM ---------- Previous post was at 12:25 AM ----------

Edit: This works perfect for reading values from MW3, but I don't get it how to do it with bytes. I'm using your memory class at the moment so i can care about the other things, so you might could help me

For Integer the code is, of course: Convert.ToString(ReadInteger(address));
Now I want to read a bytelist using Convert.ToString(ReadBytes(addresse, bytelength)); - but that just gives me "System.Byte[]", doesnt matter which bytelength i enter - any idea why or how to fix it?

Thanks
Posts 1–15 of 20 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us