$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) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB2" '/*------------------------------------------------------------------*/ ' BS2A STRING,ARRAY$() ' Binary String to Array. ' Copies the CR/LF delimited segments withing STRING to ARRAY$(). ' You MUST ensure the ARRAY$() has been dimensioned properly to ' contain all instances within STRING. ' The number of elements is placed into ARRAY$(0). ' EXAMPLE: BS2A A$,F$() ' '/*------------------------------------------------------------------*/ SUB BS2A(BYVAL X AS STRING, F$()) PUBLIC T$ = CHR$(13) LX = LEN(X) EP = 0 SP = 1 CNT = 0 DO EP = INSTR(SP,X,T$) IF EP > SP THEN CNT = CNT + 1 F$(CNT) = MID$(X,SP,EP-SP) SP = EP + 2 END IF LOOP UNTIL SP => LX F$(0) = STR$(CNT) END SUB '/*------------------------------------------------------------------*/ ' $INCLUDE "C:\CODE\MLIB\MLIB.INC" ' CLS ' DIM F$(100) ' PRINT "TESTING BS2A FUNCTION ' T$ = F2BS("C:\AUTOEXEC.BAT") ' PRINT T$ ' INPUT Z ' BS2A T$, F$() ' N = VAL(F$(0)) ' FOR CNT = 0 TO N ' PRINT F$(CNT) ' NEXT CNT ' INPUT Z