We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TCP/IP Socket Programming
#16
Hi, not sure which bit you don't follow.

A string is in fact just an array of characters, so we can create a string by appending characters to the end of a string, this is what ' bytes = Text.Append(bytes,char) ' is doing.

So char is a single character.

A character is internally stored as a byte (00 to FF in hex), so a string as an array of bytes.  When we print a string, the char (byte) value corresponds to the character defined by the ascii code for the given byte value, so a string with byte value of 0x20 (or 32 decimal) will print a space.  Not all of the 256 ascii values are characters, some are control characters (originally derived from typewriters and mechanical input, like Line Feed, Cariage Return, Backspace, Beep etc.

So the key is to get the character (char) that corresponds to a given ascii code number, that is simply what '  Text.GetCharacter(7) ' does (7 is a machine beep).

So in the end we form a string (array of bytes) with each byte being the byte value corresponding to a character obtained from a byte value (in decimal, so we use the hex to decimal conversion '  LDMath.Base2Decimal ' for convenience).

Hope this helps.
Reply


Messages In This Thread
TCP/IP Socket Programming - by Juergen - 07-14-2025, 08:35 AM
RE: TCP/IP Socket Programming - by litdev - 07-14-2025, 02:49 PM
RE: TCP/IP Socket Programming - by Juergen - 07-16-2025, 09:40 AM
RE: TCP/IP Socket Programming - by Juergen - 07-25-2025, 10:55 AM
RE: TCP/IP Socket Programming - by litdev - 07-25-2025, 11:23 AM
RE: TCP/IP Socket Programming - by Juergen - 07-25-2025, 11:48 AM
RE: TCP/IP Socket Programming - by litdev - 07-25-2025, 01:12 PM
RE: TCP/IP Socket Programming - by Juergen - 07-25-2025, 06:17 PM
RE: TCP/IP Socket Programming - by litdev - 07-25-2025, 06:33 PM
RE: TCP/IP Socket Programming - by Juergen - 07-27-2025, 08:49 AM
RE: TCP/IP Socket Programming - by litdev - 07-27-2025, 10:50 AM
RE: TCP/IP Socket Programming - by Juergen - 07-27-2025, 12:21 PM
RE: TCP/IP Socket Programming - by litdev - 07-27-2025, 01:42 PM
RE: TCP/IP Socket Programming - by Juergen - 07-28-2025, 08:04 AM
RE: TCP/IP Socket Programming - by litdev - 07-28-2025, 08:32 AM
RE: TCP/IP Socket Programming - by WhTurner - 07-28-2025, 12:37 PM
RE: TCP/IP Socket Programming - by Juergen - 08-23-2025, 06:39 AM
RE: TCP/IP Socket Programming - by litdev - 08-23-2025, 12:33 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)