Version 1 (modified by 6 years ago) ( diff ) | ,
---|
FormatWt
Format a string representation of the specified weight
string FormatWt(float fWt, uint8 byIntv, uint8 byDec, int nLen = 7); char* FormatWt(float fWt, uint8 byIntv, uint8 byDec, char* pszWt, int nLen = 7);
Parameters
- fWt - weight value to format
- byIntv - interval such as 20 for twenty pound intervals.
- byDec - number of decimal places.
- nLen - length to format the string, spaces will be padded to the left.
- pszWt - buffer to copy weight data to.
Return Value
- Returns the string formatted weight. char* return override returns a pointer to the passed pszWt parameter where the result is stored.
Remarks
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.
Examples
float wt = 12055; string strWt = FormatWt(wt, 20, 0); DisplayText(0, 0, strWt); // Will display 12060
float wt = 12055; char szWt[20]; FormatWt(wt, 20, 0, szWt); DisplayText(0, 0, szWt); // Will display 12060
See Also
Note:
See TracWiki
for help on using the wiki.