Changes between Initial Version and Version 1 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/Weight/FormatWt


Ignore:
Timestamp:
10/11/18 07:12:30 (6 years ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825ev/Weight/FormatWt

    v1 v1  
     1= FormatWt =
     2Format a string representation of the specified weight
     3
     4{{{
     5string FormatWt(float fWt, uint8 byIntv, uint8 byDec, int nLen = 7);
     6
     7char* FormatWt(float fWt, uint8 byIntv, uint8 byDec, char* pszWt, int nLen = 7);
     8}}}
     9
     10== Parameters ==
     11
     12 * fWt - weight value to format
     13 * byIntv - interval such as 20 for twenty pound intervals.
     14 * byDec - number of decimal places.
     15 * nLen - length to format the string, spaces will be padded to the left.
     16 * pszWt - buffer to copy weight data to.
     17
     18== Return Value ==
     19
     20 * Returns the string formatted weight. char* return override returns a pointer to the passed pszWt parameter where the result is stored.
     21
     22== Remarks ==
     23
     24This will format the provided weight value into appropriate divisions and add zeros for zero weight if necessary based on the interval. For example, for interval of 20 lb is specified and the weight is zero the output will be "   00". The value returned is from an internal memory buffer from the last MnBdRead that received a weight for the specified scale. An application program should be structured properly for this data to be updated when needed.
     25
     26
     27== Examples ==
     28
     29{{{
     30float wt = 12055;
     31string strWt = FormatWt(wt, 20, 0);
     32DisplayText(0, 0, strWt);
     33// Will display 12060
     34}}}
     35
     36{{{
     37float wt = 12055;
     38char szWt[20];
     39FormatWt(wt, 20, 0, szWt);
     40DisplayText(0, 0, szWt);
     41// Will display 12060
     42}}}
     43
     44== See Also ==
     45
     46 * [wiki:FormatTareWt FormatTareWt]
     47 * [wiki:FormatNetWt FormatNetWt]
     48 * [wiki:FormatWt FormatWt]
     49