| 1 | = FormatWt = |
| 2 | Format a string representation of the specified weight |
| 3 | |
| 4 | {{{ |
| 5 | string FormatWt(float fWt, uint8 byIntv, uint8 byDec, int nLen = 7); |
| 6 | |
| 7 | char* 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 | |
| 24 | This 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 | {{{ |
| 30 | float wt = 12055; |
| 31 | string strWt = FormatWt(wt, 20, 0); |
| 32 | DisplayText(0, 0, strWt); |
| 33 | // Will display 12060 |
| 34 | }}} |
| 35 | |
| 36 | {{{ |
| 37 | float wt = 12055; |
| 38 | char szWt[20]; |
| 39 | FormatWt(wt, 20, 0, szWt); |
| 40 | DisplayText(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 | |