[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

small c problem



The following problem will help me finish v0.1 of my wizard radio control
program which I will ITP and upload soon..

<prepared for flames>

I know its the wrong place to ask, but its really easy, and I feel stupid
asking in a newsgroup....

string with value "number:"

integer with value "444"

I want the string to then have the value "number:444"

this is the actual C code:  (slightly snipped)

   int freq_num;
   double freq;
   char *rad_cmd;

   freq = atof(optarg);   // optarg is "98.2"

   freq_num = (int) ((freq - 76) / 0.05);   // gives 444

   rad_cmd = "number:";

   What now?  i.e.  rad_cmd+freq_num to give rad_cmd = "number:444"
   strcat()?


</prepared for flames>

                     Michael Beattie (mike@omnic.dhis.org)

 -----------------------------------------------------------------------------
                 WinErr: 001 Windows loaded - System in danger
 -----------------------------------------------------------------------------
                Debian GNU/Linux....  Ooohh You are missing out!



Reply to: