Syntax
[C/C++:]
void gConvertInteger(int number, int nwidth, char string[]);
void gConvertIntegerZero(int number, int nwidth, char string[]);
[F90:]
subroutine gConvertInteger(number, nwidth, string)
subroutine gConvertIntegerZero(number, nwidth, string)
integer, intent(in) :: number,nwidth
character*(*), intent(out) :: string
Arguments
number
Integer value
nwidth
Field width
|
< 0, |
Left-justified (gConvertInteger() only) |
string
Character string containing integer value
Description
The routines gConvertInteger() and gConvertIntegerZero() returns the integer value
number as a decimal character string in the argument
string. The format of the number is in exactly the same format as that output by gDisplayInteger() or gDisplayIntegerZero(). The string starts with a minus sign for values less than zero.
For gConvertInteger(), if the number occupies less than
nwidth character positions, the string is padded out with spaces. For positive values of
nwidth, the number is right-justified. If
nwidth is less than zero the number is left-justified.
For gConvertIntegerZero(), the number is always right justified and if the number occupies less than
nwidth character positions, the string is padded with zeros.
If
nwidth equals zero, then a blank string is returned. If the number is longer than
nwidth characters, the string is filled with asterisks.
The field width is limited to 32 character positions. If it exceeds this, it is set to 32 characters and a warning message is output.
See Also
gConvertInteger UsagegDisplayInteger