GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
xt_romantoi(3) FreeBSD Library Functions Manual xt_romantoi(3)

xt_romantoi() - Convert Roman numeral string to int

#include <xtend/stdlib.h>
-lxtend

int     xt_romantoi(const char *string, char **endptr)

string: Pointer to the first character of the Roman numeral
endptr: Address of a pointer variable to receive the end of the string

The xt_romantoi() function converts a string containing a valid Roman numeral to an integer, much like strtol(). It rejects non-normalized values, such as IIIII, XXXXX, or CCCCC, which should be written as V, L, and D, respectively. IIII, XXXX, and CCCC are accepted in place of IV, XL, and CD. Any number of consecutive Ms (1000s) are accepted, since there is no larger digit. Like strtol(), it returns the address of the first character not converted as part of the number. This can be used to verify that the number ended as it should have, perhaps with a '0' byte.

The integer value of the Roman numeral if converted, or 0 if an invalid numeral is detected.

char    string[] = "XIV", *end;
int     n;
n = xt_romantoi(string, &end);
if ( *end == '0' )

printf("%dn", n); else
fprintf(stderr, "Error converting %s.n", string);

strtol(3)


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.