 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Aug 25, 2007 10:51 am Post subject: Converting INT to Char |
|
|
Code: | GetDlgItemText(hwnd,IDC_EDIT, FarEdit, 50);
retCel((INT)FarEdit);
SetDlgItemText(hwnd,IDK_EDIT, (CHAR*)Cel); |
this is my code to call retCel function and it compiles fine
but i have trouble with the (CHAR*)Cel part of it.
it returns weird values (i assume the int to char* is the problem)
how can i pass Cel as a Char* while not messing with its value
_________________
|
|
Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Sat Aug 25, 2007 11:12 am Post subject: |
|
|
Try using strings - you are using C++ i'm assuming?
They are easier to handle:
intToString
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Sat Aug 25, 2007 5:23 pm Post subject: |
|
|
The FarEdit variable should be a pointer to a string buffer. By doing (INT)FarEdit, you're casting the pointer into an integer, not the contents. So instead of using a type cast, use the atoi, Ascii TO Integer, function (opposite would be itoa, Integer TO Ascii). Look it up for usage examples.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Sat Aug 25, 2007 6:01 pm Post subject: |
|
|
Just a note on itoa
Quote: | Portability
This function is not defined in ANSI-C and is not part of C++, but is supported by some compilers. |
Thought atoi is part of c++ and normal ANSI-C.
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Sat Aug 25, 2007 7:02 pm Post subject: |
|
|
x0r wrote: | zart wrote: | Thought atoi is part of c++ and normal ANSI-C. |
MSVCRT.dll exports them both, not a compiler only library:
msvcrt._itoa
msvcrt._atoi |
If you used a microsoft compiler, then yes:
msvcrt.dll is a module containing standard C library functions such as printf, memcpy, and cos. It is a part of the Microsoft C Runtime Library.
Besides think about it, if that .dll was THE thing that exports them - and the only one, how does it work on linux?
Here's some more material on the subject, Dr. Dobb
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON
Last edited by zart on Sat Aug 25, 2007 7:28 pm; edited 1 time in total |
|
Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Sat Aug 25, 2007 7:44 pm Post subject: |
|
|
x0r wrote: | Not at all, you can choose to import them, it's really your choice. I find it especially funny that a newbie such as yourself is preaching to me about simple APIs. Yes, the msvcrt APIs are molded around common library functions but they're not the same thing, the C libraries are coded for multiple platforms (since they don't utilize anything OS specific). |
mIRC wrote: |
[21:46] <zart> x0r
[21:46] <x0r> ?
[21:46] <zart> I'm not trying to be rude, I was just staying what it was.
[21:47] <x0r> Quote:
[21:47] <x0r> Portability
[21:47] <x0r> This function is not defined in ANSI-C and is not part of C++, but is supported by some compilers.
[21:47] <zart> itoa is not defined in ansi-c or c++
[21:47] <x0r> Horribly improper to quote that.
[21:47] <zart> And why is that?
[21:47] <x0r> C/C++ standard libraries should never be used unless you're an idiot or a cross-platform programmer.
[21:48] <zart> Who says he wasn't performing cross platform?
[21:48] <zart> Or wasn't using borland?
[21:48] <x0r> Don't play on a fallacy, the chance of that is very small.
[21:48] <zart> Listen, everyone I posted was right
[21:48] <x0r> It was improper for you to highlight the standard lib usage.
[21:48] <zart> I compile with gcc, g++ and use MSVC sometimes.
[21:49] <zart> So I wouldn't recommend someone to use itoa
[21:49] <zart> since they'll not get away with it using gcc g++
[21:49] <x0r> _itoa is a pretty good path for beginner programmers.
[21:50] <zart> listen, all I'm saying and all I posted is true
[21:50] <zart> I'm not going to "watch what I say" since I didn't say anything wrong.
[21:50] <x0r> Listen, all I'm saying that what you posted was improper.
[21:50] <zart> How is posting that improper?
[21:51] <x0r> I just fucking told you.
[21:51] <zart> I honestly don't understand how explaining that it won't port is bad
[21:51] <zart> I didn't say "HE'S WRONG" I said, here is a note
[21:51] <x0r> Sigh...
[21:52] <x0r> Teaching people to use standard C/C++ libraries is stupid unless they're planning to make it available to multiple platforms.
[21:52] <zart> I did tell him to use standard c/c++ libraries, did i?
[21:53] <x0r> "Thought atoi is part of c++ and normal ANSI-C."
[21:53] <zart> Did I tell him to use that?
[21:54] <zart> No - i said to use strings.
[21:54] <zart> I was pointing out, itoa is not part of c++ and normal ansi-c. BUT atoi IS
[21:55] <zart> Though I enjoy your negative tone - and assuming I'm a newbie - very enlightening.
[21:55] <x0r> It was a useless point and since you insinuated that he was to use generic C/C++ libraries.
[21:55] <zart> It's not a useless point.
[21:56] <zart> It's a perfectly valid one - itoa ISN'T part of c++, it's only supported by SOME compilers.
[21:56] <x0r> ITOA is a part of windows.
[21:56] <x0r> Unless you're trying to debate that msvcrt isn't packaged with windows.
[21:58] <x0r> Though I enjoy your tone, thinking you're in a position to be preaching to me
[21:58] <zart> I wasn't preaching to you, no - I was just saying that it was not part of c++.
[21:58] <zart> I shy away from giving platform specific advice since I normally have to port or right platform independant code.
[21:59] <x0r> You're dealing with game hackers.
[21:59] <zart> It can be hard to distinguish tone in text, but I assure you - I wasn't trying to be insulting - just helpful. I remember in university when I got bogged down with itoa.
[22:00] <zart> Game hackers or not, I'd rather not give out platform specifics. I wasn't trying to out do you, just saying that it is platform specific.
[22:03] <x0r> You're failing to acknowledge the demographic here.
[22:03] <zart> Also while I havn't use Borland as a compiler in a long time, I'm not positive it uses msvcrt.dll by default.
[22:03] <zart> Honestly - I don't care what the demographic is.
[22:03] <x0r> Then don't post.
[22:04] <x0r> You're preaching interoperability to a group which doesn't care about.
[22:04] <zart> The information I stated was correct, I was noting to someone about the itoa function.
[22:06] <zart> I still don't see how any of this is improper or how understand portability makes me a newbie. I also don't remember seeing anything about rules for code having to only be posted for win32
[22:07] <x0r> Something erroneous in this environment.
[22:07] <x0r> Let me rephrase, you're either blind or oblivious to the blatantly obvious.
[22:09] <x0r> That wasn't too nice.
[22:09] <x0r> I apologize.
|
So... Everything we both said is correct. If you only coding for windows - yea, use itoa. Though it is not portable - and I stand by that since nothing I said was incorrect.
Strange how pointing something out, and correctly is considered being a newbie.
Edit: Ohhh - <sigh> I had to only because I thought this was funny.
irc wrote: |
[22:14] <x0r> Wow, you're an idiot.
[22:14] <x0r> Posting that log wasn't too smart.
[22:15] <zart> It's the easiest way to show exactly what the code does, we explained it ourselves.
[22:15] <x0r> No it wasn't.
[22:15] <x0r> Now you've really offended me.
[22:15] <x0r> If you had any common sense at all you would regard privacy.
[22:15] <zart> Sorry, I must be blind - or a newbie.
[22:16] <x0r> A variation of both.
[22:16] <zart> I'll still sleep soundly.
[22:16] <x0r> Good to hear.
[22:16] <x0r> mmm, you did this in malice
[22:16] <zart> No
[22:16] <x0r> Yes you did.
[22:16] <zart> I just did want to bother retyping why we where both right.
[22:17] <x0r> Consider your "future" here dim.
[22:17] <zart> that was the easiest way.
[22:17] <x0r> Bye.
[22:18] [Kick] You have been kicked from channel #cef by [^_^] (Enemy Of The State).
|
That was posted out of 'malice' of your 'threat' - sorry
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Aug 25, 2007 8:12 pm Post subject: |
|
|
Code: | GetDlgItemText(hwnd,IDC_EDIT, FarEdit, 50);
atoi(FarEdit);
retCel((INT)FarEdit);
itoa(Cel, temp, 10);
SetDlgItemText(hwnd,IDK_EDIT, Cel); |
like that? i still get an invalid conversion >.>
_________________
|
|
Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Sat Aug 25, 2007 8:21 pm Post subject: |
|
|
blankrider wrote: | Code: | GetDlgItemText(hwnd,IDC_EDIT, FarEdit, 50);
atoi(FarEdit);
retCel((INT)FarEdit);
itoa(Cel, temp, 10);
SetDlgItemText(hwnd,IDK_EDIT, Cel); |
like that? i still get an invalid conversion >.> |
I don't know what exactly your doing from the snippet, but did you declare temp? Is that the right variable your trying to use itoa on? Or do you mean to use FarEdit in it's place?
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Sat Aug 25, 2007 8:22 pm Post subject: |
|
|
blankrider wrote: | Code: | GetDlgItemText(hwnd,IDC_EDIT, FarEdit, 50);
atoi(FarEdit);
retCel((INT)FarEdit);
itoa(Cel, temp, 10);
SetDlgItemText(hwnd,IDK_EDIT, Cel); |
like that? i still get an invalid conversion >.> |
atoi is a function: it returns something. Take my first advice and read on some usage examples...
As for the itoa debate... when in doubt, implement your own.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Aug 25, 2007 8:28 pm Post subject: |
|
|
wow dumb
i got it
i win
_________________
|
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Aug 25, 2007 9:09 pm Post subject: My first c++ program |
|
|
whee noob much?
_________________
|
|
Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
|
Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sun Aug 26, 2007 1:44 am Post subject: |
|
|
x0r, giving relevant and helpful information regarding standardization... I don't see how that could ever be bad or "improper".
Here is where you TELL them to use the C standard libraries (regardless what you say, MSVCRT is an implementation of the C std libs, even if it has some non-standard functions).
zart wrote: | Just a note on itoa ... | Here is where zart gives information that would be important in certain scenarios.
IRC Log wrote: | [22:04] <x0r> You're preaching interoperability to a group which doesn't care about. | Huh? x0r, you don't speak for the members of this forum. Not only that, this section is "General Programming", not "Gamehacking Specific Programming".
If anything, Zart pointing out the inconsistencies between the various C library implementations only discourage their use. You on the other hand told them to use the MS C library, and then went on an idiotic tirade about how evil zart is for posting useful information.
~nog_lorp
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Last edited by nog_lorp on Sun Aug 26, 2007 9:07 am; edited 1 time in total |
|
Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sun Aug 26, 2007 9:19 am Post subject: |
|
|
x0r wrote: | In this situation it's needless. | Again, that's not for you to decide.
x0r wrote: | Not at all, it's stupid to suggest that people would only think that C standard libraries have itoa/atoi. | atoi has existed primarily as a C standard library functions for 18 years. Itoa has been in many for nearly as long. If you read my post, you will see I do not think only the C standard libraries have these. Please counter my original point: you are suggesting people use an implementation of these libraries.
x0r wrote: | I don't, I know how this community thinks and I already stated proof that this user was working on a win32 platform. | We can tell from original post that he is using Win32. Now please respond to the rest of my paragraph on this subject (prove he will never ever use a POSIX OS or Linux).
x0r wrote: | No, if anything you're the one who's going on an idiotic tirade, the fact is that you're only participating to get at me, that's why you made a topic in the Dark Alliance forums right? Zart pointed out something needless which would only lead people astray and you're only trying to point out something false to lead people astray  | Please read http://dictionary.reference.com/browse/tirade. A six second post is really that long/prolonged. As for emotionality, lets count personal attacks in this thread. Me: 1 against x0r (idiotic tirade comment).
zart: 0.
x0r: 9.
Who has been more emotional/vehement??
Lastly, to read about x0r's debate technique used above, read here. The page uses one of your favorite words x0r, fallacy. Although it doesn't use 'redundant', which I'm sure will disappoint you.
~nog_lorp
EDIT: another good one here
And another! x0r needs to read up on fallacies before he talks about them to others... here
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
Back to top |
|
 |
thenewguy Grandmaster Cheater
Reputation: -1
Joined: 04 Jun 2006 Posts: 972
|
Posted: Sun Aug 26, 2007 12:17 pm Post subject: |
|
|
x0r wrote: | zart is a manipulative idiot. |
who is what?
haha
It must be opposite day in xor's 'sponge bob square pants' little world
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|