Author | Message | Time |
---|---|---|
LordVader | basically in short: In C/C++ info: 'c9' is expected and other similar info but i want to pass the data in variable -> zsVerByte instead. that one problem is hanging me up all over unable to make needed switches for client case matches etc.. alot of different needed things heh. example: dBuf.add((int)'c9'); Am new to C++ In: globals.h Would like to define: #define GAME_VERBYTE zsVerByte char zsVerByte[32]; And be able to reuse that properly but unsure of how to parse that elsewhere, to use in ifstatments and switches.. would appreciate any small examples just to see diff ways to accomplish this.. *Note zsVerByte ready to store/redefine the verbyte which comes from the config (storing the data to zsVerByte isn't the issue, using it is) Thx - Vad | August 18, 2004, 12:02 AM |
Myndfyr | Allright, I'm going to go off on a limb (and granted, I'm sleep-deprived so my English may be a bit off at the moment), but I'm going to suggest that you write in complete sentences and make understandable statements if you want to get help. I really, honestly, have absolutely no idea what you're asking or what you're trying to do. Example: "info: 'c9' as an int is expected and other similar info" What does that mean, exactly? Also, the typical Hungarian notation for naming strings is prefacing them with "sz", not "zs." That's a cosmetic note, but one perhaps worth pointing out to you. ;) Also, a version byte is transferred from the BNCS via a DWORD, which is a 32-bit (4-byte) value. It is defined somewhere as: [code] typedef unsigned long int DWORD; [/code] Another good point, then, would be to ask why you're allocating 8 times the amount of memory necessary (32 bytes as opposed to 4 bytes) to store the version byte, *unless* you're not trying to store the version byte itself. If you're trying to convert to a string, I believe the itoa(int, char *, int) function is for you. | August 18, 2004, 12:09 AM |
LordVader | Updated original post, and also i'm new to C++ and win32api programming in general. I'm familiar with php/perl/java in web applications. As for the rest i'm trying to learn so any critique and information is usable and good.. I'm trying to update an old bot from old source to current verbyte and x50/x51 login and replacing the "static" values of star/c9 thru out the code with variables.. basically to learn the source compiles with static values and works fine. Trying pass the data in different places and to add switches/case matches for say: GAME_VERBYTE (which would be the data from zsVerByte). Where it used to only have static raw text for the values.. I'm learning and reading as much as i can to get my head wrapped around it all. | August 18, 2004, 12:18 AM |
LordVader | thx for the link btw and quick responce :P | August 18, 2004, 12:22 AM |
LordVader | for a direct example.. this put buffer string: dBuf.add((int)'c9'); how would i convert that to use the data in variable -> zsVerByte which is char zsVerByte[32]; and contains the data c9 *I'll modify my variable[32] to a more appropriate size, either [4] or [2] | August 18, 2004, 12:27 AM |
LordVader | That page answered my ?'s was basically needing to compare two strings see if they were the same :) This page also is a good resource same site: http://www.cplusplus.com/doc/tutorial/tut3-2.html | August 20, 2004, 4:34 AM |