[Gambas-user] how print each char/possition in string including spaces
PICCORO McKAY Lenz
mckaygerhard at ...626...
Thu Dec 10 21:27:37 CET 2015
2015-12-10 15:03 GMT-04:30 ML <d4t4full at ...626...>:
> For example take newline or LineFeed. ASCII code &H0A. Non-printable,
> but in Linux -and Gambas- you can refer to it as "\n".
I made a loop until Lof(buffer) and the "\n" are not taken same as the
ascii u mentioned, but this its minor problem that i can deal later
> Remember that ASC will only return the ASCII code of the FIRST character
> in a string. If you need several, you will have to use a loop.
this is a very important info that i never take in consideration!
that's why i always see in console the number "2", due the string
always have the STX at begin of the buffer.. ..
> You can think of the "^" prefix like subtracting &H40 from the next
> character's ASCII code.
> What you see as "^A" (analogous to Ctrl-A in the keyboard) refers to
> ASCII control code SOH (ASCII &H01).
> It comes from ASC("A") - &H40 = 1: The old teletype CONTROL keys just
> resetted bit 6 (value is 64, or &H40) of the character key pressed with it.
> I'm sure you saw "^[" when you press Escape in some (console) programs:
> ASC("[" (ASCII ESC).
>
> The double-character combination you see is the OS's best effort to make
> printable something that is not.
So i can made a loop, that prints/add each converted char to a new
variable.. but i tried it to made a llop :
a) until Lof(Sport) but due data comes something > 8 bits i got two
times the event _Read() so i must change to retund each char..
b) i cannot (or i dont know how) return each char, so i return the
complete string, but dont work
c) try with a while until Len(buffer) but dont work! due the event
_Read if the data comes with 8 bits reach two times
> Try this in Gambas:
>
> Dim myString As String = Chr$(27) 'Escape, char &H1B
> Message.Info("Character '" & myString & "', ASCII code: " & Asc(myString))
> myString = "\n" 'Linefeed, char (ASCII &H0A)
> Message.Info("Character '" & myString & "', ASCII code: " & Asc(myString))
i ask if can made a function to convert each result? by example:
1) the event _Read only returns the string
2) a function that received only when the _Read event will reach with data
3) the function only load a string if are data until receive the ACK
or NOK ascii
umm but right now i not have idea how in a subfuction trap the _read event...
>
> I also made Fiscal Printer Drivers. Under my belt are at least
> Venezuela, Bulgaria, Chile, Panama, Argentina, and even Russia.
> They are ALL a freaking pain in the lower back, and there are few -if
> any- standards, as they all depend on crazy laws made by crazier people.
> Bad news, I made them all in Win/VB6 for my company. Advantage of VB in
> these cases is the existence of Win-libraries.
respect that i mail private to you for more specific info and feedback
More information about the User
mailing list