$CPU 8086 ' make compatible with XT systems $LIB ALL OFF ' turn off all PowerBASIC libraries $ERROR ALL OFF ' turn off all PowerBASIC error checking $OPTIMIZE SIZE ' optimize for smaller code $COMPILE UNIT ' compile to a UNIT (.PBU) '$COMPILE EXE ' compile to a UNIT (.PBU) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ ' A2F FILESPEC, ARRAY$() ' Array to File (Sequential). ' This opens FILESPEC as output and writes the contents ' of ARRAY$() to it. ' You MUST load the number of elements to be written into ' ARRAY$(0). ' A CR/LF pair is written at the end of each record. ' EXAMPLE: D$(0) = STR$(20) ' A2F "C:\DATA\DOUT.DAT", D$() ' ' DIM D$(100) ' CLS ' FOR X = 1 TO 20 ' D$(X) = STR$(X) ' NEXT X ' D$(0) = STR$(X-1) ' A2F "C:\TEST.DAT", D$() ' SHELL "TYPE C:\TEST.DAT" ' INPUT Z ' '/*------------------------------------------------------------------*/ $CODE SEG "MLIB4" '/*------------------------------------------------------------------*/ SUB A2F(BYVAL FILESPEC AS STRING, D$()) PUBLIC N = VAL(D$(0)) FFN = FREEFILE OPEN "O",FFN,FILESPEC CNT = 0 FOR CNT = 1 TO N PRINT#FFN, D$(CNT) NEXT CNT CLOSE#FFN END SUB '/*------------------------------------------------------------------*/ ' DIM D$(100) ' CLS ' FOR X = 1 TO 20 ' D$(X) = STR$(X) ' NEXT X ' D$(0) = STR$(X-1) ' A2F "C:\TEST.DAT", D$() ' SHELL "TYPE C:\TEST.DAT" ' INPUT Z