Code: Select all
#Include Once "crt/stdio.bi"
#Include "jevans4949/csvread.bi"
#Include "jevans4949/getfname.bi"
'***********************************************************************
' Test Driver
'***********************************************************************
Dim y As csvfile Ptr
Dim R As Integer
Dim q As String
Dim As Integer i,j,k
Dim ff As Long
Print"Started"
y=New csvfile
y->buffsize=8192
ff=FreeFile
Open "p:csvreader.log" For Output As #ff
Do
Select Case q
Case "N","n" 'next
R = csvread(*y)
Print "rc:";r
If r = 5 Then
Exit do
EndIf
write #ff,"Name:", y->fields(8)
Case "w","W" 'next loop
While y->nrows<500
R = csvread(*y)
If r=2 Then
write #ff,"Name:",y->fields(8)
Else
Print "rc:";r
Exit Do
EndIf
Wend
Case "Q","q" 'quit
Exit Do
Case "P", "p"
Print "File Handle: ";Hex(y->fptr,8)
Print "File Name: ";*y->fname
print "Is open:";y->isopen
Print "At EOF:";y->ateof
Print "UTF:";y->utf
Print "Buff pos";y->bb
Print "Buff end";y->be
Print "Rows Retrieved:";y->nrows
Print "Columns:";y->fi
Case "B","b"
j= y->bb-10
If j<1 Then j=1
k=j+20
If k>UBound(y->buff) Then k = UBound(y->buff)
For i = j To k
If y->buff(i)>32 Andalso y->buff(i)<126 Then
Print Chr(y->buff(i));
else
Print "[";Hex(y->buff(i),2);"]";
EndIf
Next
Case "h","H"
For i=i To UBound(y->headers)
Print y->headers(i)
Next
Case "d","D"
For i =1 To ubound(y->fields)
Print y->fields(i)
Next
End Select
Close #ff
Input q
Loop
sleep
Wrote this program to test a Library, CSVREAD, which I have written and it works, but the WRITE# statements to produce a log file don't seem to work. I used WRITE# as PRINT# didn't work eiher. WRITE without # goes to console with expected results. The file is just empty. Tried writing to different drive, same non-result. Any clues?
Using compiler version 1.07.1 64bit.