| 1130 | |
| 1131 | |
| 1132 | static int conv_ntoc( SLONG numeric_in, TEXT char_out[]) |
| 1133 | { |
| 1134 | /******************************************************************** |
| 1135 | ** |
| 1136 | ** c o n v _ n t o c |
| 1137 | ** |
| 1138 | ********************************************************************* |
| 1139 | ** |
| 1140 | ** Functional description: |
| 1141 | ** |
| 1142 | ** Convert 4-digit numeric data to a 4-byte character array. |
| 1143 | ** |
| 1144 | ********************************************************************* |
| 1145 | */ |
| 1146 | |
| 1147 | if (numeric_in <= 0) |
| 1148 | return FB_FAILURE; |
| 1149 | |
| 1150 | int i = numeric_in; |
| 1151 | int indx = 3; |
| 1152 | |
| 1153 | while (indx >= 0 && i > 0) |
| 1154 | { |
| 1155 | const int mod = i % 10; |
| 1156 | char_out[indx] = '0' + mod; |
| 1157 | --indx; |
| 1158 | i = i / 10; |
| 1159 | } |
| 1160 | |
| 1161 | if (i > 0) // number was too big |
| 1162 | return FB_FAILURE; |
| 1163 | |
| 1164 | for (; indx >= 0; indx--) { |
| 1165 | char_out[indx] = ' '; |
| 1166 | } |
| 1167 | return FB_SUCCESS; |
| 1168 | } |
| 1169 | |
| 1170 | |
| 1171 | static int write_header(const b_fil* fl_ptr, |
no outgoing calls
no test coverage detected