home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- FUNCTION ARWRITE (text_array, text_file)
- *****************************************************************
-
- * Writes an array to a text file
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL array_bytes := file_bytes := handle := 0, ret_value := .F.
-
- * Test array argument and create text file
- IF LEN(text_array) > 0 .AND. ARTYPE(text_array, 'C') ;
- .AND. (handle := FCREATE(text_file)) != -1
-
- * If successful, add each line of the array to it
- AEVAL(text_array, { | element | ( file_bytes := file_bytes + ;
- FWRITE(handle, element + CHR(13)+CHR(10), ;
- LEN(element)+2) ) , (array_bytes := array_bytes + ;
- LEN(element) + 2) })
-
- * Test bytes written verses array size and close file
- ret_value := IF(file_bytes=array_bytes .AND. array_bytes !=0 ;
- .AND. FCLOSE(handle), .T., .F.)
-
- ENDIF
-
- RETURN ret_value
-
-
-