B4R Question Join string + number

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
I'd like to open files for read in sequence i.e. file1.dat, file2.dat, file3.dat... etc. any ideas, got errors when trying to join string (filename) and decimal counter.

Thanks
 
binary files of 504 bytes each, holding bitmap of images, i will load file data to an array then display it on LCD, this procedure works very fine, but i need to send file names in sequence to display images in sequence one after another, image1.bin, imag2.bin and so on

i.e. LoadImageFile(image1.bin) 'works very fine and display image ok

Code: Copy
private Sub LoadImageFile (fileName As String)
    Dim Buffer (504) As Byte
    If Sd.OpenRead(fileName) Then
            Sd.Stream .ReadBytes(Buffer,0,503)
            Sd.OpenRead("") 'some dirty dots appear at the end, that's the only way worked to removed them
            Sd.Close
        WriteByte(0x80, 0)
        WriteByte(0x40, 0)
        WriteByte(0x80, 0)
        Dim testbyte As Byte
        For i=0 To 503
            testbyte = Buffer(i)
            WriteByte(testbyte, 1)
        Next    
    End If
End Sub

but i want to make
Code: Copy
For M = 0 To 10
        Dim filename As String
        filename = JoinStrings("image",m,".bin")
      LoadImageFile(filename)
    Next

I get this error
Cannot cast type: {Type=StringLiteral,Rank=0, RemoteObject=True} to: {Type=String,Rank=1, RemoteObject=True}
 
Upvote 0
I did not guess the code and error, i wrote the code already and got that error message, then I posted that question because i could not handle it, may be not posting the code at first was a mistake.

Thanks for help
 
Upvote 0

Similar Threads

  • Article Article
B4R Code Snippet JSON Parsing
Replies
1
Views
10K
Replies
9
Views
8K
Replies
5
Views
3K
  • Locked
  • Article Article
B4R Tutorial Strings and Bytes
Replies
8
Views
30K
Back
Top