|
Purpose |
Functions that print data in map fields |
|
|
Syntax |
int prn_c(mapnr, fieldnr, data)
|
|
|
Parameters |
int mapnr |
Map containing field to print data |
|
|
int fieldnr |
Number of field to print data in |
|
|
<type> data |
Variable or pointer to variable in which to place data to be printed |
|
|
The <type> of the parameter data depends on which of the prn_x() functions is being used, as shown below. Also shown is the corresponding DP4 datatype for each of the prn_x() functions: |
|
| Function | Type | DP4 datatype |
|---|---|---|
|
prn_c |
char * |
C,M,S,U |
|
prn_d |
datetype * |
D |
|
prn_h |
short |
I,J,K |
|
prn_l |
long |
L |
|
prn_n |
double |
N |
|
prn_t |
timetype * |
T |
|
prn_y |
BOOLEAN |
Y |
|
Description |
These functions print the data in the specified field of the given map. You are recommended to set up the output properties for data fields with MAPEDIT. This enables you to change the format without having to change the program. You can also control the format in which the data is printed with the global variables show_flags and showd_flags. The global variable show_flags is used for all the prn_x() functions except prn_d which uses the global variable showd_flags. These global variables are initialised to the value DEFAULT. The global variables show_flags and showd_flags may take any suitable combination of the following values: |
||
|
|
Value |
Meaning |
|
|
|
DEFAULT |
The data is formatted using the flags set in MAPEDIT. This is the preferred method of controlling print formats. (If no format flags are set in MAPEDIT, the user preferences are used). |
|
|
|
NOT_DEFAULT |
You can use this value when the format you want corresponds to the absence of any of the explicify format flags but you won'd want to use the users preferred default format. |
|
|
|
SKIP_MISSING_FIELD |
Allows the program to silently the ignore the system error which would normally be generated if the field to be printed into is missing from the map. |
|
|
|
BLANK_IF_ZERO |
The field is left blank if you print a value of zero |
|
|
|
LEFT_JUSTIFY |
This left justifies the data printed within a field |
|
|
|
RIGHT_JUSTIFY |
This right justifies the data printed within a field |
|
|
|
FILL_WITH_ASTERISK |
This places asterisks (*) in the portion of a field that is not used for printing data |
|
|
|
NO_LEADING_ZEROS |
This suppresses zeros from the front of numeric data |
|
|
|
LEADING_ZEROS |
This adds zeros to the front of numeric data |
|
|
|
TRAILING_MINUS |
This places a minus sign (-) at the end of negative numbers |
|
|
|
IN_PARENTHESIS |
This places brackets ( () ) around negative numbers |
|
|
|
WITH_COMMAS |
This places commas (,) between every 3 digits of numeric data |
|
|
|
LONG_YEAR |
This prints dates with the year in full, for example 1993 rather than 93 |
|
|
|
YEAR_FIRST |
This prints dates with the year first |
|
|
|
MONTH_FIRST |
This prints dates with the month first |
|
|
|
MONTH_NAME |
This prints dates with the month in words. The words used are those that you set in the user preferences |
|
|
|
NO_SEPARATOR |
This prints dates without any separating character (such as /) between the day, month and year |
|
|
|
SHOW_SECONDS |
This includes seconds when times are printed |
|
|
|
SHOW_HUNDREDTHS |
This includes hundredths of seconds when times are printed |
|
|
|
Numeric DataWhen using numeric data, you must set the global variable show_flags to DEFAULT or any suitable combination of: BLANK_IF_ZERO, LEFT_JUSTIFY, RIGHT_JUSTIFY, FILL_WITH_ASTERISK, LEADING_ZEROS, NO_LEADING_ZEROS, TRAILING_MINUS, IN_PARENTHESIS, WITH_COMMAS, NOT_DEFAULT, SKIP_MISSING_FIELD DatesWhen using dates, you must set the global variable showd_flagsto DEFAULT or any suitable combination of: LONG_YEAR, YEAR_FIRST, MONTH_FIRST, MONTH_NAME, NO_SEPARATOR, NOT_DEFAULT, SKIP_MISSING_FIELD TimesWhen using times, you must set the global variable show_flags to DEFAULT or any suitable combination of: SHOW_SECONDS, SHOW_HUNDREDTHS, NO_SEPARATOR, NOT_DEFAULT, SKIP_MISSING_FIELD To print multi-occurs fields you should use the function prn() directly unless character fields are being printed, in which case you can still use the function prn_c(). |
||
|
See also |
|||
|
Example |
|
||