| 1098 | // |
| 1099 | |
| 1100 | void CPR_get_text( TEXT* buffer, const gpre_txt* text) |
| 1101 | { |
| 1102 | SLONG start = text->txt_position; |
| 1103 | int length = text->txt_length; |
| 1104 | |
| 1105 | // On PC-like platforms, '\n' will be 2 bytes. The txt_position |
| 1106 | // will be incorrect for fseek. The position is not adjusted |
| 1107 | // just for PC-like platforms because, we use fseek () and |
| 1108 | // getc to position ourselves at the token position. |
| 1109 | // We should keep both character position and byte position |
| 1110 | // and use them appropriately. for now use getc () |
| 1111 | |
| 1112 | #if (defined WIN_NT) |
| 1113 | if (fseek(trace_file, 0L, 0)) |
| 1114 | #else |
| 1115 | if (fseek(trace_file, start, 0)) |
| 1116 | #endif |
| 1117 | { |
| 1118 | fseek(trace_file, 0L, 2); |
| 1119 | CPR_error("fseek failed for trace file"); |
| 1120 | } |
| 1121 | #if (defined WIN_NT) |
| 1122 | // move forward to actual position |
| 1123 | |
| 1124 | while (start--) |
| 1125 | getc(trace_file); |
| 1126 | #endif |
| 1127 | |
| 1128 | TEXT* p = buffer; |
| 1129 | while (length--) |
| 1130 | *p++ = getc(trace_file); |
| 1131 | fseek(trace_file, (SLONG) 0, 2); |
| 1132 | } |
| 1133 | |
| 1134 | |
| 1135 | //____________________________________________________________ |
no test coverage detected