1 // ----------------------------------------------------------------------------
2 // textio.cxx
3 //
4 // Copyright (C) 2006-2010
5 //		Dave Freese, W1HKJ
6 //
7 // This file is part of fldigi.
8 //
9 // Fldigi is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // Fldigi is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with fldigi.  If not, see <http://www.gnu.org/licenses/>.
21 // ----------------------------------------------------------------------------
22 
23 #include <config.h>
24 
25 #include <string>
26 #include <cstdio>
27 #include <cstring>
28 
29 #include "textio.h"
30 #include "lgbook.h"
31 #include "globals.h"
32 
33 using namespace std;
34 
35 #ifdef __WOE32__
36 static const char *szEOL = "\r\n";
37 #else
38 static const char *szEOL = "\n";
39 #endif
40 
adif_to_date(char * s)41 char * cTextFile::adif_to_date( char *s) {
42 static char date[9];
43 	strcpy(date, "  /  /  ");
44 	for (int i = 0; i < 2; i++) {
45 		date[i+6] = s[i+2];
46 		date[i] = s[i+4];
47 		date[i+3] = s[i+6];
48 	}
49 	return date;
50 }
51 
adif_to_time(char * s)52 char * cTextFile::adif_to_time( char *s) {
53 static char time[6];
54 	strcpy(time, "  :  ");
55 	for (int i = 0; i < 2; i++) {
56 		time[i] = s[i];
57 		time[i+3] = s[i+2];
58 	}
59 	return time;
60 }
61 
writeCSVHeader(FILE * txtFile)62 void cTextFile::writeCSVHeader(FILE *txtFile)
63 {
64 	if (btnSelectQSOdateOn->value()) fprintf (txtFile, "%s", "\"DATE_ON\"");
65 	if (btnSelectQSOdateOff->value())fprintf (txtFile, "%s", ",\"DATE_OFF\"");
66 	if (btnSelectTimeON->value())    fprintf (txtFile, "%s", ",\"ON\"");
67 	if (btnSelectTimeOFF->value())   fprintf (txtFile, "%s", ",\"OFF\"");
68 	if (btnSelectCall->value())      fprintf (txtFile, "%s", ",\"CALL\"");
69 	if (btnSelectName->value())      fprintf (txtFile, "%s", ",\"NAME\"");
70 	if (btnSelectBand->value())      fprintf (txtFile, "%s", ",\"BAND\"");
71 	if (btnSelectFreq->value())      fprintf (txtFile, "%s", ",\"FREQ\"");
72 	if (btnSelectMode->value())      fprintf (txtFile, "%s", ",\"MODE\"");
73 	if (btnSelectTX_pwr->value())    fprintf (txtFile, "%s", ",\"TX_PWR\"");
74 	if (btnSelectRSTsent->value())   fprintf (txtFile, "%s", ",\"RSTSENT\"");
75 	if (btnSelectRSTrcvd->value())   fprintf (txtFile, "%s", ",\"RSTRCVD\"");
76 	if (btnSelectQth->value())       fprintf (txtFile, "%s", ",\"QTH\"");
77 	if (btnSelectState->value())     fprintf (txtFile, "%s", ",\"ST\"");
78 	if (btnSelectProvince->value())  fprintf (txtFile, "%s", ",\"PR\"");
79 	if (btnSelectCNTY->value())      fprintf (txtFile, "%s", ",\"CNTY\"");
80 	if (btnSelectCountry->value())   fprintf (txtFile, "%s", ",\"CNTRY\"");
81 	if (btnSelectDXCC->value())      fprintf (txtFile, "%s", ",\"DXCC\"");
82 	if (btnSelectCQZ->value())       fprintf (txtFile, "%s", ",\"CQZONE\"");
83 	if (btnSelectIOTA->value())      fprintf (txtFile, "%s", ",\"IOTA\"");
84 	if (btnSelectCONT->value())      fprintf (txtFile, "%s", ",\"CONT\"");
85 	if (btnSelectITUZ->value())      fprintf (txtFile, "%s", ",\"ITUZ\"");
86 	if (btnSelectLOC->value())       fprintf (txtFile, "%s", ",\"GRIDSQUARE\"");
87 	if (btnSelectQSLrcvd->value())   fprintf (txtFile, "%s", ",\"QSL_RCVD\"");
88 	if (btnSelectQSLsent->value())   fprintf (txtFile, "%s", ",\"QSL_SENT\"");
89 	if (btnSelecteQSLrcvd->value())  fprintf (txtFile, "%s", ",\"EQSL_RCVD\"");
90 	if (btnSelecteQSLsent->value())  fprintf (txtFile, "%s", ",\"EQSL_SENT\"");
91 	if (btnSelectLOTWrcvd->value())  fprintf (txtFile, "%s", ",\"LOTW_RCVD\"");
92 	if (btnSelectLOTWsent->value()) fprintf (txtFile, "%s", ",\"LOTW_SENT\"");
93 	if (btnSelectNotes->value())     fprintf (txtFile, "%s", ",\"NOTES\"");
94 	if (btnSelectSerialIN->value())  fprintf (txtFile, "%s", ",\"SERIAL RCVD\"");
95 	if (btnSelectSerialOUT->value()) fprintf (txtFile, "%s", ",\"SERIAL_SENT\"");
96 	if (btnSelectXchgIn->value())    fprintf (txtFile, "%s", ",\"XCHG1\"");
97 	if (btnSelectMyXchg->value())    fprintf (txtFile, "%s", ",\"MYXCHG\"");
98 	if (btnSelectClass->value())     fprintf (txtFile, "%s", ",\"CLASS\"");
99 	if (btnSelectSection->value())   fprintf (txtFile, "%s", ",\"ARRl_SECT\"");
100 	if (btnSelectOperator->value())  fprintf (txtFile, "%s", ",\"OPER\"");
101 	if (btnSelectStaCall->value())   fprintf (txtFile, "%s", ",\"STA_CALL\"");
102 	if (btnSelectStaGrid->value())   fprintf (txtFile, "%s", ",\"STA_GRID\"");
103 	if (btnSelectStaCity->value())   fprintf (txtFile, "%s", ",\"STA_CITY\"");
104 	if (btnSelectCheck->value())     fprintf (txtFile, "%s", ",\"CHECK\"");
105 	if (btnSelectAge->value())       fprintf (txtFile, "%s", ",\"AGE\"");
106 	if (btnSelect_1010->value())     fprintf (txtFile, "%s", ",\"10-10\"");
107 	fprintf (txtFile, "%s", szEOL);
108 }
109 
110 
writeCSVFile(const char * fname,cQsoDb * db)111 int cTextFile::writeCSVFile (const char *fname, cQsoDb *db) {
112 	cQsoRec *pRec = (cQsoRec *)0;
113 	FILE *txtFile = fl_fopen (fname, "w");
114 	if (!txtFile) return 1;
115 
116 	if (txtFile) {
117 		writeCSVHeader(txtFile);
118 		for (int i = 0; i < db->nbrRecs(); i++) {
119 			pRec = db->getRec(i);
120 			if (pRec->getField(EXPORT)[0] == 'E') {
121 				if (btnSelectQSOdateOn->value())
122 					fprintf (txtFile, "\"%s\"", pRec->getField(QSO_DATE));
123 				if (btnSelectQSOdateOff->value())
124 					fprintf (txtFile, ",\"%s\"", pRec->getField(QSO_DATE_OFF));
125 				if (btnSelectTimeON->value())
126 					fprintf (txtFile, ",\"%s\"", pRec->getField(TIME_ON));
127 				if (btnSelectTimeOFF->value())
128 					fprintf (txtFile, ",\"%s\"", pRec->getField(TIME_OFF));
129 				if (btnSelectCall->value())
130 					fprintf (txtFile, ",\"%s\"", pRec->getField(CALL));
131 				if (btnSelectName->value())
132 					fprintf (txtFile, ",\"%s\"", pRec->getField(NAME));
133 				if (btnSelectBand->value())
134 					fprintf (txtFile, ",\"%s\"", pRec->getField(BAND));
135 				if (btnSelectFreq->value())
136 					fprintf (txtFile, ",\"%s\"", pRec->getField(FREQ));
137 				if (btnSelectMode->value()) {
138 					if (!adif2submode(pRec->getField(ADIF_MODE)).empty())
139 						fprintf (txtFile, ",\"%s\"", adif2submode(pRec->getField(ADIF_MODE)).c_str());
140 					else
141 						fprintf (txtFile, ",\"%s\"", adif2export(pRec->getField(ADIF_MODE)).c_str());
142 				}
143 				if (btnSelectTX_pwr->value())
144 					fprintf (txtFile, ",\"%s\"", pRec->getField(TX_PWR));
145 				if (btnSelectRSTsent->value())
146 					fprintf (txtFile, ",\"%s\"", pRec->getField(RST_SENT));
147 				if (btnSelectRSTrcvd->value())
148 					fprintf (txtFile, ",\"%s\"", pRec->getField(RST_RCVD));
149 				if (btnSelectQth->value())
150 					fprintf (txtFile, ",\"%s\"", pRec->getField(QTH));
151 				if (btnSelectState->value())
152 					fprintf (txtFile, ",\"%s\"", pRec->getField(STATE));
153 				if (btnSelectProvince->value())
154 					fprintf (txtFile, ",\"%s\"", pRec->getField(VE_PROV));
155 				if (btnSelectCNTY->value())
156 					fprintf (txtFile, ",\"%s\"", pRec->getField(CNTY));
157 				if (btnSelectCountry->value())
158 					fprintf (txtFile, ",\"%s\"", pRec->getField(COUNTRY));
159 				if (btnSelectDXCC->value())
160 					fprintf (txtFile, ",\"%s\"", pRec->getField(DXCC));
161 				if (btnSelectCQZ->value())
162 					fprintf (txtFile, ",\"%s\"", pRec->getField(CQZ));
163 				if (btnSelectIOTA->value())
164 					fprintf (txtFile, ",\"%s\"", pRec->getField(IOTA));
165 				if (btnSelectCONT->value())
166 					fprintf (txtFile, ",\"%s\"", pRec->getField(CONT));
167 				if (btnSelectITUZ->value())
168 					fprintf (txtFile, ",\"%s\"", pRec->getField(ITUZ));
169 				if (btnSelectLOC->value())
170 					fprintf (txtFile, ",\"%s\"", pRec->getField(GRIDSQUARE));
171 
172 				if (btnSelectQSLrcvd->value())
173 					fprintf (txtFile, ",\"%s\"", pRec->getField(QSLRDATE));
174 				if (btnSelectQSLsent->value())
175 					fprintf (txtFile, ",\"%s\"", pRec->getField(QSLSDATE));
176 
177 				if (btnSelecteQSLrcvd->value())
178 					fprintf (txtFile, ",\"%s\"", pRec->getField(EQSLRDATE));
179 				if (btnSelecteQSLsent->value())
180 					fprintf (txtFile, ",\"%s\"", pRec->getField(EQSLSDATE));
181 
182 				if (btnSelectLOTWrcvd->value())
183 					fprintf (txtFile, ",\"%s\"", pRec->getField(LOTWSDATE));
184 				if (btnSelectLOTWsent->value())
185 					fprintf (txtFile, ",\"%s\"", pRec->getField(LOTWSDATE));
186 
187 				if (btnSelectNotes->value()) {
188 					string temp = pRec->getField(NOTES);
189 					for (size_t n = 0; n < temp.length(); n++)
190 						if (temp[n] == '\r' || temp[n] == '\n') temp[n] = '-';
191 					fprintf (txtFile, ",\"%s\"", temp.c_str());
192 				}
193 				if (btnSelectSerialIN->value())
194 					fprintf (txtFile, ",\"%s\"", pRec->getField(SRX));
195 				if (btnSelectSerialOUT->value())
196 					fprintf (txtFile, ",\"%s\"", pRec->getField(STX));
197 				if (btnSelectXchgIn->value())
198 					fprintf (txtFile, ",\"%s\"", pRec->getField(XCHG1));
199 				if (btnSelectMyXchg->value())
200 					fprintf (txtFile, ",\"%s\"", pRec->getField(MYXCHG));
201 
202 				if (btnSelectClass->value())
203 					fprintf (txtFile, ",\"%s\"", pRec->getField(CLASS));
204 				if (btnSelectSection->value())
205 					fprintf (txtFile, ",\"%s\"", pRec->getField(ARRL_SECT));
206 
207 				if (btnSelectOperator->value())
208 					fprintf (txtFile, ",\"%s\"", pRec->getField(OP_CALL));
209 				if (btnSelectStaCall->value())
210 					fprintf (txtFile, ",\"%s\"", pRec->getField(STA_CALL));
211 				if (btnSelectStaGrid->value())
212 					fprintf (txtFile, ",\"%s\"", pRec->getField(MY_GRID));
213 				if (btnSelectStaCity->value())
214 					fprintf (txtFile, ",\"%s\"", pRec->getField(MY_CITY));
215 
216 				if (btnSelectCheck->value())
217 					fprintf (txtFile, ",\"%s\"", pRec->getField(CHECK));
218 				if (btnSelectAge->value())
219 					fprintf (txtFile, ",\"%s\"", pRec->getField(AGE));
220 				if (btnSelect_1010->value())
221 					fprintf (txtFile, ",\"%s\"", pRec->getField(TEN_TEN));
222 
223 				fprintf (txtFile, "%s", szEOL);
224 				pRec->putField(EXPORT,"");
225 				db->qsoUpdRec(i, pRec);
226 			}
227 		}
228 		fclose (txtFile);
229 	}
230 	return 0;
231 }
232 
233 // text file in fixed fields
writeTXTHeader(FILE * txtFile)234 void cTextFile::writeTXTHeader(FILE *txtFile)
235 {
236 	if (btnSelectQSOdateOn->value()) fprintf (txtFile, "%-10s", "DATE_ON");
237 	if (btnSelectQSOdateOff->value())fprintf (txtFile, "%-10s", "DATE_OFF");
238 	if (btnSelectTimeON->value())    fprintf (txtFile, "%-8s", "ON");
239 	if (btnSelectTimeOFF->value())   fprintf (txtFile, "%-8s", "OFF");
240 	if (btnSelectCall->value())      fprintf (txtFile, "%-10s", "CALL");
241 	if (btnSelectName->value())      fprintf (txtFile, "%-15s", "NAME");
242 	if (btnSelectBand->value())      fprintf (txtFile, "%-7s", "BAND");
243 	if (btnSelectFreq->value())      fprintf (txtFile, "%-12s", "FREQ");
244 	if (btnSelectMode->value())      fprintf (txtFile, "%-8s", "MODE");
245 	if (btnSelectTX_pwr->value())    fprintf (txtFile, "%-8s", "TX_PWR");
246 
247 	if (btnSelectRSTsent->value())   fprintf (txtFile, "%-6s", "RSTX");
248 	if (btnSelectRSTrcvd->value())   fprintf (txtFile, "%-6s", "RSTR");
249 	if (btnSelectQth->value())       fprintf (txtFile, "%-20s", "QTH");
250 	if (btnSelectState->value())     fprintf (txtFile, "%-5s", "ST");
251 	if (btnSelectProvince->value())  fprintf (txtFile, "%-5s", "PR");
252 	if (btnSelectCountry->value())   fprintf (txtFile, "%-15s", "CNTRY");
253 	if (btnSelectCNTY->value())      fprintf (txtFile, "%-8s",  "CNTY");
254 	if (btnSelectDXCC->value())      fprintf (txtFile, "%-8s",  "DXCC");
255 	if (btnSelectCQZ->value())       fprintf (txtFile, "%-8s",  "CQZONE");
256 	if (btnSelectIOTA->value())      fprintf (txtFile, "%-8s", "IOTA");
257 	if (btnSelectCONT->value())      fprintf (txtFile, "%-8s",  "CONT");
258 	if (btnSelectITUZ->value())      fprintf (txtFile, "%-8s",  "ITUZ");
259 	if (btnSelectLOC->value())       fprintf (txtFile, "%-15s", "GRIDSQUARE");
260 
261 	if (btnSelectQSLrcvd->value())   fprintf (txtFile, "%-10s", "QSLR");
262 	if (btnSelectQSLsent->value())   fprintf (txtFile, "%-10s", "QSLS");
263 
264 	if (btnSelecteQSLrcvd->value())   fprintf (txtFile, "%-10s", "EQSLR");
265 	if (btnSelecteQSLsent->value())   fprintf (txtFile, "%-10s", "EQSLS");
266 
267 	if (btnSelectLOTWrcvd->value())  fprintf (txtFile, "%-10s", "LOTWR");
268 	if (btnSelectLOTWsent->value())  fprintf (txtFile, "%-10s", "LOTWS");
269 
270 	if (btnSelectNotes->value())     fprintf (txtFile, "%-80s", "NOTES");
271 	if (btnSelectSerialIN->value())  fprintf (txtFile, "%-7s", "SRX");
272 	if (btnSelectSerialOUT->value()) fprintf (txtFile, "%-7s", "STX");
273 	if (btnSelectXchgIn->value())    fprintf (txtFile, "%-15s", "XCHG1");
274 	if (btnSelectMyXchg->value())    fprintf (txtFile, "%-15s", "MYXCHG");
275 
276 	if (btnSelectClass->value())     fprintf (txtFile, "%-15s", "CLASS");
277 	if (btnSelectSection->value())   fprintf (txtFile, "%-15s", "ARRL_SECT");
278 
279 	if (btnSelectOperator->value())  fprintf (txtFile, "%-15s", "OPER");
280 	if (btnSelectStaCall->value())   fprintf (txtFile, "%-15s", "STA_CALL");
281 	if (btnSelectStaGrid->value())   fprintf (txtFile, "%-15s", "STA_GRID");
282 	if (btnSelectStaCity->value())   fprintf (txtFile, "%-15s", "STA_CITY");
283 
284 	if (btnSelectCheck->value())     fprintf (txtFile, "%-15s", "CHECK");
285 	if (btnSelectAge->value())       fprintf (txtFile, "%-15s", "AGE");
286 	if (btnSelect_1010->value())     fprintf (txtFile, "%-15s", "10-10");
287 
288 	fprintf (txtFile, "%s", szEOL);
289 }
290 
writeTXTFile(const char * fname,cQsoDb * db)291 int cTextFile::writeTXTFile (const char *fname, cQsoDb *db) {
292 	cQsoRec *pRec = (cQsoRec *)0;
293 	FILE *txtFile = fl_fopen (fname, "w");
294 	if (!txtFile) return 1;
295 
296 	if (txtFile) {
297 		writeTXTHeader(txtFile);
298 		for (int i = 0; i < db->nbrRecs(); i++) {
299 			pRec = db->getRec(i);
300 			if (pRec->getField(EXPORT)[0] == 'E') {
301 				if (btnSelectQSOdateOn->value())
302 					fprintf (txtFile, "%-10s", pRec->getField(QSO_DATE));
303 				if (btnSelectQSOdateOff->value())
304 					fprintf (txtFile, "%-10s", pRec->getField(QSO_DATE_OFF));
305 				if (btnSelectTimeON->value())
306 					fprintf (txtFile, "%-8s", pRec->getField(TIME_ON));
307 				if (btnSelectTimeOFF->value())
308 					fprintf (txtFile, "%-8s", pRec->getField(TIME_OFF));
309 				if (btnSelectCall->value())
310 					fprintf (txtFile, "%-10s", pRec->getField(CALL));
311 				if (btnSelectName->value())
312 					fprintf (txtFile, "%-15s", pRec->getField(NAME));
313 				if (btnSelectBand->value())
314 					fprintf (txtFile, "%-7s", pRec->getField(BAND));
315 				if (btnSelectFreq->value())
316 					fprintf (txtFile, "%-12s", pRec->getField(FREQ));
317 				if (btnSelectMode->value()) {
318 					if (!adif2submode(pRec->getField(ADIF_MODE)).empty())
319 						fprintf (txtFile, "%-12s", adif2submode(pRec->getField(ADIF_MODE)).c_str());
320 					else
321 						fprintf (txtFile, "%-12s", adif2export(pRec->getField(ADIF_MODE)).c_str());
322 				}
323 				if (btnSelectTX_pwr->value())
324 					fprintf (txtFile, "%-8s", pRec->getField(TX_PWR));
325 				if (btnSelectRSTsent->value())
326 					fprintf (txtFile, "%-6s", pRec->getField(RST_SENT));
327 				if (btnSelectRSTrcvd->value())
328 					fprintf (txtFile, "%-6s", pRec->getField(RST_RCVD));
329 				if (btnSelectQth->value())
330 					fprintf (txtFile, "%-20s", pRec->getField(QTH));
331 				if (btnSelectState->value())
332 					fprintf (txtFile, "%-5s", pRec->getField(STATE));
333 				if (btnSelectProvince->value())
334 					fprintf (txtFile, "%-5s", pRec->getField(VE_PROV));
335 				if (btnSelectCountry->value())
336 					fprintf (txtFile, "%-15s", pRec->getField(COUNTRY));
337 				if (btnSelectCNTY->value())
338 					fprintf (txtFile, "%-8s", pRec->getField(CNTY));
339 				if (btnSelectDXCC->value())
340 					fprintf (txtFile, "%-8s", pRec->getField(DXCC));
341 				if (btnSelectCQZ->value())
342 					fprintf (txtFile, "%-8s", pRec->getField(CQZ));
343 				if (btnSelectIOTA->value())
344 					fprintf (txtFile, "%-8s", pRec->getField(IOTA));
345 				if (btnSelectCONT->value())
346 					fprintf (txtFile, "%-8s", pRec->getField(CONT));
347 				if (btnSelectITUZ->value())
348 					fprintf (txtFile, "%-8s", pRec->getField(ITUZ));
349 				if (btnSelectLOC->value())
350 					fprintf (txtFile, "%-15s", pRec->getField(GRIDSQUARE));
351 				if (btnSelectQSLrcvd->value())
352 					fprintf (txtFile, "%-10s", pRec->getField(QSLRDATE));
353 				if (btnSelectQSLsent->value())
354 					fprintf (txtFile, "%-10s", pRec->getField(QSLSDATE));
355 				if (btnSelecteQSLrcvd->value())
356 					fprintf (txtFile, "%-10s", pRec->getField(EQSLRDATE));
357 				if (btnSelecteQSLsent->value())
358 					fprintf (txtFile, "%-10s", pRec->getField(EQSLSDATE));
359 				if (btnSelectLOTWrcvd->value())
360 					fprintf (txtFile, "%-10s", pRec->getField(LOTWRDATE));
361 				if (btnSelectLOTWsent->value())
362 					fprintf (txtFile, "%-10s", pRec->getField(LOTWSDATE));
363 				if (btnSelectNotes->value()) {
364 					string temp = pRec->getField(NOTES);
365 					for (size_t n = 0; n < temp.length(); n++)
366 						if (temp[n] == '\n') temp[n] = ';';
367 					fprintf (txtFile, "%-80s", temp.c_str());
368 				}
369 				if (btnSelectSerialIN->value())
370 					fprintf (txtFile, "%-7s", pRec->getField(SRX));
371 				if (btnSelectSerialOUT->value())
372 					fprintf (txtFile, "%-7s", pRec->getField(STX));
373 				if (btnSelectXchgIn->value())
374 					fprintf (txtFile, "%-15s", pRec->getField(XCHG1));
375 				if (btnSelectMyXchg->value())
376 					fprintf (txtFile, "%-15s", pRec->getField(MYXCHG));
377 
378 				if (btnSelectClass->value())
379 					fprintf (txtFile, "%-15s", pRec->getField(CLASS));
380 				if (btnSelectSection->value())
381 					fprintf (txtFile, "%-15s", pRec->getField(ARRL_SECT));
382 
383 				if (btnSelectOperator->value())
384 					fprintf (txtFile, "%-15s", pRec->getField(OP_CALL));
385 				if (btnSelectStaCall->value())
386 					fprintf (txtFile, "%-15s", pRec->getField(STA_CALL));
387 				if (btnSelectStaGrid->value())
388 					fprintf (txtFile, "%-15s", pRec->getField(MY_GRID));
389 				if (btnSelectStaCity->value())
390 					fprintf (txtFile, "%-15s", pRec->getField(MY_CITY));
391 
392 				if (btnSelectCheck->value())
393 					fprintf (txtFile, "%-15s", pRec->getField(CHECK));
394 				if (btnSelectAge->value())
395 					fprintf (txtFile, "%-15s", pRec->getField(AGE));
396 				if (btnSelect_1010->value())
397 					fprintf (txtFile, "%-15s", pRec->getField(TEN_TEN));
398 
399 				fprintf (txtFile, "%s", szEOL);
400 				pRec->putField(EXPORT,"");
401 				db->qsoUpdRec(i, pRec);
402 			}
403 		}
404 		fclose (txtFile);
405 	}
406 	return 0;
407 }
408 
409