Logo Search packages:      
Sourcecode: hamlib version File versions  Download package

int HAMLIB_API sprintf_freq ( char *  str,
freq_t  freq 
)

Pretty print a frequency.

Parameters:
str for result (may need up to 17 char)
freq input in Hz
rig_freq_snprintf? pretty print frequencies str must be long enough. max can be as long as 17 chars

Definition at line 211 of file misc.c.

{
      double f;
      char *hz;

      if (llabs(freq) >= GHz(1)) {
            hz = "GHz";
            f = (double)freq/GHz(1);
      } else if (llabs(freq) >= MHz(1)) {
            hz = "MHz";
            f = (double)freq/MHz(1);
      } else if (llabs(freq) >= kHz(1)) {
            hz = "kHz";
            f = (double)freq/kHz(1);
      } else {
            hz = "Hz";
            f = (double)freq;
      }

      return sprintf (str, "%g %s", f, hz);
}


Generated by  Doxygen 1.6.0   Back to index