BCX Console Demonstration Program s103.bas

'  *********************************************************************** 
'             Dir2Htm Win32 command line utility by Kevin Diggins 
'               Written for BCX -- My Free BASIC to C Translator 
'  *********************************************************************** 
'   Dir2Htm creates a file named INDEX.HTM which holds links to the files 
'   in the directory that it is run in.  Dir2Htm with no arguments links 
'   all files in the directory.  Optionally, passing a File Specification 
'   ( wildcards okay ) will link only files matching that specification. 
'  *********************************************************************** 

DIM A$, B$, C$
DIM FileSpec$

FileSpec$ = COMMAND$

C$ = REPLACE$(CURDIR$,"\","/") + "/"

IF FileSpec$ = "" THEN FileSpec$ = "*.*"

OPEN "index.htm" FOR OUTPUT AS FP1
FPRINT FP1,"<HTML>"
FPRINT FP1,"<HEAD>"
FPRINT FP1,"<TITLE>File Index</TITLE>"
FPRINT FP1,"</HEAD>"
FPRINT FP1,"<BODY>"

A$ = FINDFIRST$(FileSpec$)

WHILE A$ <> ""
  B$ = "<A href="../ + DQ$ + "file://" + C$ + A$ + DQ$ + ">" + A$ + "</A><BR>"
  A$ = FINDNEXT$
  FPRINT FP1, B$
WEND

FPRINT FP1, "</BODY>"
FPRINT FP1, "</HTML>"
CLOSE FP1

Result:

Result not displayed for this example.