Bug? rSD OpenReadWrite

kohle

Active Member
Licensed User
Longtime User
Hi,

when a file DONT exists it will be created on the sd card.
When you write a line into the file with writeBytes , the line is two times (doubled)
in the file.
The sd.CurrentFile.Size shows in that moment : 11 bytes
correct should be 0 bytes.


This only happens when you run the sketch from b4r IDE.

When you delete the file on the sd card again , and start the Adri. Uno alone, like pushing the reset button, it works fine.

The sd.CurrentFile.Size shows in that moment : 0 bytes, thats correct.





<code>

filename = "test7.dat"

If sd.OpenReadWrite(filename)=True Then

Log("BytesAvaible:",sd.Stream.BytesAvailable)
Log("CurrentSize: ",sd.CurrentFile.Size)

Dim te As String
Dim wB As UInt
Dim b() As Byte

te = JoinStrings(Array As String("A test line",CRLF))
b=bc.StringToBytes(te)

sd.Position = sd.CurrentFile.Size
wB = sd.Stream.WriteBytes(b, 0 ,b.Length)



Log("Written:",wB," ",te)

sd.Close

Else
Log("Cant open/create")
End If

</code>
 
Top