Link to home
Start Free TrialLog in
Avatar of WackoMike
WackoMike

asked on

minor bug with output

char* site;
site = "http://www.somesite.com/file.php?arg=1&arg2=hrm";

strcat(site,Realm());
            
      
MessageBox(0,site,"test",1);



char*Realm()
{

      char* realm;
      int one, two = 0;
      one = rand(); // this gives player one a dice roll
    two = rand(); // this gives player two a dice roll
          if (one < two)
            {
               realm = "UsEast";
        }
        else
            {
                  realm = "UsWest";
        }


      return realm;

}



the problem is that it was making my messagebox title the last part of the realm like ast or est

ASKER CERTIFIED SOLUTION
Avatar of Santino_k
Santino_k

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WackoMike
WackoMike

ASKER

Tried doing that...did not work for me. :-/
ok fixed it instead of using

site = "url";

i used

strcat(site,"url");
this seems to only cause more memory errors down the road...
I am sorry I missed out the strcat(...) after memory allocation.
You allocate memory and then do a strcat(...). This is ideal way to do it.
Thanks for points :-)