Hello everyone I would appreciate some help with a problem that I am not able to solve....
I tried this code snippet
it works perfectly, but when I try to print a lot of data it just doesn't work.
If I make a loop that prints for example 100 lines, there comes a time when it stops working. So, If I put a pause (e.g. msgbox) on that loop... it works! ¿¿??
I have to flush at the end of each line?
I have to wait for something before sending the next line or closing the BT connection?
Here is an example of my code....
I tried this code snippet
it works perfectly, but when I try to print a lot of data it just doesn't work.
If I make a loop that prints for example 100 lines, there comes a time when it stops working. So, If I put a pause (e.g. msgbox) on that loop... it works! ¿¿??
I have to flush at the end of each line?
I have to wait for something before sending the next line or closing the BT connection?
Here is an example of my code....
B4X:
Sub btPRINTER_Connected (Success As Boolean)
Dim prnBUF As TextWriter
Dim txtENC As String
Dim lstBUF As List
Dim i As Int
' I dont know the apropiate CP for spanish chars like ó, ñ or €
txtENC = "CP858"
lstBUF = File.ReadList(dir, fic)
If Success Then
prnBUF.Initialize2(btCONN.OutputStream,txtENC)
For i = 0 To lstBUF.Size - 1
prnBUF.WriteLine(lstBUF.Get(i))
prnBUF.Flush
' For large amount of lines only works with this pause
Msgbox("LIN." & i & CRLF & lstBUF.Get(i),"TEST")
Next
prnBUF.Flush
prnBUF.Close
ToastMessageShow("("&lstBUF.Size&") Done...",False)
Else
Msgbox("ERROR...","ERROR BT")
End If
' I must wait before close?
btCONN.Disconnect
End Sub
Last edited: