[C] 纯文本查看 复制代码 /* Define my numeric format function. */
VOID my_format_function(GX_NUMERIC_PROMPT *prompt, INT value)
{
/* If the value is “1234”, the new format will be “12.34”. */
INT length;
gx_utility_ltoa(value / 100, prompt->gx_numeric_prompt_buffer,
GX_NUMERIC_PROMPT_ BUFFER_SIZE);
Length = GX_STRLEN(prompt->gx_numeric_prompt_buffer);
prompt->gx_numeric_prompt_buffer[length++] = ‘.’;
gx_utility_ltoa(value % 100,
prompt->gx_numeric_prompt_buffer + length,
GX_NUMERIC_PROMPT_BUFFER_SIZE - length);
}
/* Override the default format function of “my_numeric_prompt”. */
status = gx_numeric_prompt_format_function_set(&my_numeric_prompt,
my_format_function);
/* If status is GX_SUCCESS, the format function of “my_numeric_prompt” has been override. */ |