diff -ru dbf-0.8.3.1.orig/src/csv.c dbf-0.8.3.1/src/csv.c
--- dbf-0.8.3.1.orig/src/csv.c	Fri Apr 16 17:08:50 2004
+++ dbf-0.8.3.1/src/csv.c	Sat Aug  6 23:42:17 2005
@@ -106,13 +106,13 @@
  */
 int
 writeCSVLine(FILE *fp, const struct DB_FIELD * header,
-    const unsigned char *value, int header_length,
+    unsigned char *value, int header_length,
     const char *in /* unused */, const char *out /* unused */)
 {
 
 	while (--header_length)
 	{
-		const unsigned char *begin, *end;
+		unsigned char *begin, *end;
 		int isstring, isfloat;
 
 		header++;
@@ -142,8 +142,11 @@
 			/* This routine must be verified in several tests */
 			if (isfloat) {
 				char *fmt = malloc(20);
+				unsigned char ch = *(begin+header->field_length);
 				sprintf(fmt, "%%%d.%df", header->field_length, header->field_decimals);
-				fprintf(fp, fmt, *(double *)begin);
+				*(begin+header->field_length) = 0;
+				fprintf(fp, fmt, atof(begin));
+				*(begin+header->field_length) = ch;
 				begin += header->field_length;
 			} else {
 				do {
diff -ru dbf-0.8.3.1.orig/src/csv.h dbf-0.8.3.1/src/csv.h
--- dbf-0.8.3.1.orig/src/csv.h	Fri Apr 16 17:08:50 2004
+++ dbf-0.8.3.1/src/csv.h	Sat Aug  6 23:39:08 2005
@@ -46,6 +46,7 @@
     int header_length, const char *input, const char *separator);
 int writeCSVHeader (FILE *fp, const struct DB_FIELD * header,
     int header_length, const char *input, const char *output);
-int writeCSVLine (FILE *fp, const struct DB_FIELD * header, const unsigned char *value,
-    int header_length, const char *input, const char *output);
+int writeCSVLine (FILE *fp, const struct DB_FIELD * header,
+    unsigned char *value, int header_length, const char *input,
+    const char *output);
 #endif
diff -ru dbf-0.8.3.1.orig/src/dbf.c dbf-0.8.3.1/src/dbf.c
--- dbf-0.8.3.1.orig/src/dbf.c	Fri Apr 16 17:08:50 2004
+++ dbf-0.8.3.1/src/dbf.c	Sat Aug  6 23:45:50 2005
@@ -130,7 +130,7 @@
 
 static int
 printDBF(FILE *output, const struct DB_FIELD * header,
-    const unsigned char *value, int header_length,
+    unsigned char *value, int header_length,
     const char *filename, const char *export_filename)
 {
 	const struct DB_FIELD *dbf;
diff -ru dbf-0.8.3.1.orig/src/dbf.h dbf-0.8.3.1/src/dbf.h
--- dbf-0.8.3.1.orig/src/dbf.h	Fri Apr 16 17:08:50 2004
+++ dbf-0.8.3.1/src/dbf.h	Sat Aug  6 23:39:24 2005
@@ -46,11 +46,10 @@
 extern unsigned int dbversion;
 
 typedef int	(*headerMethod)(FILE *output, const struct DB_FIELD * header,
-    int header_length,
-    const char *filename, const char *export_filename);
+    int header_length, const char *filename, const char *export_filename);
 
 typedef int	(*lineMethod)(FILE *output, const struct DB_FIELD * header,
-    const unsigned char *value, int header_length,
-    const char *filename, const char *export_filename);
+    unsigned char *value, int header_length, const char *filename,
+    const char *export_filename);
 
 #endif
diff -ru dbf-0.8.3.1.orig/src/sql.c dbf-0.8.3.1/src/sql.c
--- dbf-0.8.3.1.orig/src/sql.c	Fri Apr 16 17:08:50 2004
+++ dbf-0.8.3.1/src/sql.c	Sat Aug  6 23:43:56 2005
@@ -159,7 +159,7 @@
 /* fills the SQL table */
 int
 writeSQLLine (FILE *fp, const struct DB_FIELD * header,
-    const unsigned char *value, int header_length,
+    unsigned char *value, int header_length,
     const char *filename, const char *export_filename)
 {
 	const struct DB_FIELD *dbf;
@@ -168,7 +168,7 @@
 	    tablelen, export_filename);
 
 	for (dbf = header + 1; --header_length; dbf++) {
-		const unsigned char *end, *begin;
+		unsigned char *end, *begin;
 		int isstring = (dbf->field_type == 'M' || dbf->field_type == 'C');
 		int isdate = (dbf->field_type == 'D');
 		int isbool = (dbf->field_type == 'L');
@@ -242,8 +242,11 @@
 		} else if (dbf->field_type == 'B' || dbf->field_type == 'F') {	
 		
 			char *fmt = malloc(20);
+			unsigned char ch = *(begin+dbf->field_length);
 			sprintf(fmt, "%%%d.%df", dbf->field_length, dbf->field_decimals);
-			fprintf(fp, fmt, *(double *)begin);
+			*(begin+dbf->field_length) = 0;
+			fprintf(fp, fmt, atof(begin));
+			*(begin+dbf->field_length) = ch;
 			begin += dbf->field_length;
 			
 		} else {		
diff -ru dbf-0.8.3.1.orig/src/sql.h dbf-0.8.3.1/src/sql.h
--- dbf-0.8.3.1.orig/src/sql.h	Fri Apr 16 17:08:50 2004
+++ dbf-0.8.3.1/src/sql.h	Sat Aug  6 23:39:42 2005
@@ -40,8 +40,7 @@
     const char *filename, const char *mode /* ``l''. or ``r'', or ``b'' */);
 int writeSQLHeader(FILE *fp, const struct DB_FIELD * header, int header_length,
     const char *filename, const char *export_filename);
-int writeSQLLine(FILE *fp, const struct DB_FIELD * header,
-    const unsigned char *value, int header_length,
-    const char *filename,  const char *export_filename);
+int writeSQLLine(FILE *fp, const struct DB_FIELD * header, unsigned char *value,
+    int header_length, const char *filename,  const char *export_filename);
 
 #endif
