![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Argh...
The problem is here: playerRace = {'H', 'u', 'm', 'a', 'n', 0};// note: these two do exactly the same thing
char playerRace[] = {'H', 'u', 'm', 'a', 'n', 0};
char playerRace[] = "Human";char human[] = "Human";
for (int i = 0; i < 6; i++)
{
playerRace[i] = human[i];
}Fortunately, there's a function in the cstring library that does just that for you: strcpy(playerRace, "Human"); // does the same thing Of course, you could just pack the whole thing in and use C++ strings instead of C strings: #include <string> ... std::string playerRace; ... playerRace = "Human"; |
|
|
|
|
|
#12 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
:banana: :banana:
:banana: :banana: YES!!!!!!!!!! Lol, DaWei, I kept forgetting u said something about strcpy. Your right, I wasn't paying attention!(lol) Thanks to Ooble, it hit me. My game compiles fine now. I learned a lot about C++ and the power of strcpy and it's family with this one thread lol. When I am done with the first version of my game, I will post the source on this site. I can;t tell you guys how thankful I am that u were so patient. Thanks.
__________________
Kids, every year, more than 400,000 people die from tobacco chewing, smoking, an- MY GOD, HERE COMES A ZOMBIE PIRATE NINJA!!!!!! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|