Home > Archive > VC Language > May 2006 > Format Hex values
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| lakepeir@yahoo.com 2006-05-25, 7:08 pm |
| There's a structure called NumberFmt that allows the formatting of
numeric values. Is there a similar structure that takes Hex values and
checks the validity of the hex value?
Thanks.
| |
| Sean M. DonCarlos 2006-05-25, 7:08 pm |
| "lakepeir@yahoo.com" wrote:
> There's a structure called NumberFmt that allows the formatting of
> numeric values. Is there a similar structure that takes Hex values and
> checks the validity of the hex value?
I'm not quite sure what you mean, since NUMBERFMT is primarily intended for
specifying a particular number (base-10) representation. It doesn't actually
validate anything.
If you're trying to format a hexadecimal number as a string, you can use the
sprintf_s family (for CRT and Win32), CString::Format (for MFC), or
System::String::Format (for .NET).
Sean
| |
| Igor Tandetnik 2006-05-25, 7:08 pm |
| lakepeir@yahoo.com wrote:
> There's a structure called NumberFmt that allows the formatting of
> numeric values. Is there a similar structure that takes Hex values
> and checks the validity of the hex value?
Do you want to format a hex number, or to parse it? See strtoul for
parsing, sprintf for formatting.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
|
|
|
|
|