View Single Post
Old Jul 10th, 2005, 7:11 PM   #8
hbweb500
Newbie
 
Join Date: Jul 2005
Posts: 4
Rep Power: 0 hbweb500 is on a distinguished road
I see. My bad, I thought I did post in the C++ forum. Ive been up for a while, I should get some sleep.

Im still not completely understanding the function of the COUT. Note that this is not a console app, im actually going to be outputting the data to an edit box.\

Now I tried this, and I get "?????????????????????????????????????
" output into my edit box.

This is my code:
TCHAR bldngname[80];
                   NameBuilding(1,bldngname);
                   wsprintf (tempc,"%S\n", bldngname);

SetDlgItemText(hwnd, IDC_OUTPUT, tempc);

Notcie I changed the first value of NameBuilding to 1 to make sure I wasnt passing a bad value. It should call for a Crystal Mine.

tempc is a TCHAR array.

NameBuilding() ties to this:

VOID NameBuilding(int bldng, TCHAR *bldngname)
{

     switch(bldng)
     {
                  case 0:
                  wsprintf(bldngname, "%S","Metal Mine");
                  break;
                  
                  case 1:
                  wsprintf(bldngname, "%S","Crystal Mine");
                  break;
                  
                  case 2:
                  wsprintf(bldngname, "%S","Deuterium Mine");
                  break;
                  
                  case 3:
                  wsprintf(bldngname, "%S","Solar Plant");
                  break;
                  
                  case 4:
                  wsprintf(bldngname, "%S","Robotic Plant");
                  break;
                  
                  case 5:
                  wsprintf(bldngname, "%S","Shipyard");
                  break;
                  
                  case 6:
                  wsprintf(bldngname, "%S","Metal Storage");
                  break;
                  
                  case 7:
                  wsprintf(bldngname, "%S","Crystal Storage");
                  break;
                  
                  case 8:
                  wsprintf(bldngname, "%S","Deuterium Tank");
                  break;
                  
                  case 9:
                  wsprintf(bldngname, "%S","Research Lab");
                  break;
                  
                  case 10:
                  wsprintf(bldngname, "%S","Rocket Silo");
                  break;
                  }

}

P.S. I know my code is shoddy, but Im not a professional. I only code maybe once a year for very specialized projects, and sometime I will have to study further. If it looks like I have no clue what Im doing, its true. Hey, at least I dont leetspeak.

Last edited by hbweb500; Jul 10th, 2005 at 7:35 PM.
hbweb500 is offline   Reply With Quote