Arrays

New to FreeBASIC? Post your questions here.
fxm
Moderator
Posts: 12082
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Arrays

Post by fxm »

fxm wrote:
MrSwiss wrote:second line (quick run): fbc -s console -exx
Yes, but the IDE does not provide a "pause" to read the run-time error message!
MrSwiss wrote:<sarcasm>fxm, just put a *Sleep* at the end (of code) and, your massive problem is solved</sarcasm>
I take that for a joke, but beginners can check that it does not work:

Code: Select all

Redim As Integer array(1 To 1)
Print array(0)

Print "End of program"
Sleep
KenHorse
Posts: 56
Joined: Jan 27, 2012 0:08

Re: Arrays

Post by KenHorse »

Thanks for the input. Yes I see my mistake by not defining Buf() as a UByte

What I'm trying to do is send a binary file to an embedded device that uses XMODEM for its transfer protocol (yes I know that's antiquated but it's a legacy device and I'm stuck with it)

I read the file in 128 byte groups, load the array with each byte and then need to output to the embedded device using XMODEM protocols. That is why I asked about being able to do a binary send of the complete array without any LF or CR.

This seems to work:

Code: Select all

For A = 1 to 128                                
    Print Chr(Buf(A));                                
 Next
Trinity
Posts: 214
Joined: Sep 16, 2017 17:07

Re: Arrays

Post by Trinity »

Brilliant discussion with a lot of info to pick up from - including FXMs "Nth time" advice that people can read without FXM repeating it (N+x)th time also - I mean if only people knew that all the info about IDEs and use of binary were buried here next to the info about the arrays. (I knew about the possibility to set IDE options but have not started to give compiler options a serious look , but I will see if I can remember FXMs "Nth time" advice)
Post Reply