No announcement yet.

ASCII characters- using all of them?

  • Filter
  • Time
  • Show
Clear All
new posts

  • ASCII characters- using all of them?

    I am trying to make a coding system whereby I can shorten long
    names Los Angeles, Los Angeles County, California, United States
    for example to no more than four characters. I -had- hoped to
    be able to read into am array (say Khar$(N) for example) all the
    characters in the ASCII except except nul (first one in the
    ASCII table), tab (9th one in ASCII table), and CR (13th one in
    ASCII table), eof (26th one in ASCII table) and character # 255.
    That would give me 250 characters with which to work.

    But, PB seems to want to work with the lower case letters,
    capital letters, and numbers. By the way, my code for Los
    Angeles worked out to [239][4][20][20]. New Orleans is
    [249][190][150][162] Looks confusing, but in about 20 seconds in
    my head, I can reverse the code and arrive at the original

    For those interested, instead of using a base 10 or base 16
    numbering system, I am hopeing to use a base 250 or base 251
    for this.

    The numbers inside the brackets are the character to print on the
    ASCII table. Can I use the rest of the ASCII table?

    Thank you.


  • #2
    I'm not quite sure what the question is but you can put all
    ASCII characters into an array. i.e.

    a$ = chr$(something) + chr$(something else) + chr$(nausated) up
    to 32K in length. Doesn't matter what the numbers are except to
    say they need to fall into the range of 0-255 inclusive.

    BTW: If you can extend your program to compress all text words
    to a 4-digit string, you can probably make a fortune in the
    file compression category.

    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.


    • #3
      Originally posted by Mel Bishop:
      If you can extend your program to compress all text words
      to a 4-digit string, you can probably make a fortune in the
      file compression category.
      Well, four CHARACTER string, anyway.

      Think of the airport codes for a moment. LAX is Los Angeles
      Airport. DUL is Dulles Airport. I was looking for a +short+ way
      to represent Country, State, County, City/town in no more than
      four characters. I hope/plan to apply the codes on my PDA.

      United States, California, Los Angeles County, Los Angeles could
      be represented by four characters (I think if I use a base
      251 system.!)

      I will write a simple one tomorrow using your example, and if it
      works, great! If not, may I post the code and explain what I
      expected to get and let someone tell me my error please?



      • #4
        Sounds like one (easy) way would be to use a simple sequential file in which you stored the strings, and a "line number" or "seek" position could be stored in the actual data record. You might even use PowerTREE to index the words if you need fast look-ups or searches for existing names, etc.

        (Just an idea )

        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        mailto:[email protected]


        • #5
          They may be going in your array OK, but when you PRINT on the screen you have to be using the correct setting for $IPRINT or some of those characters will behave as "control" characters. (e.g., CR, LF, VT,BEL etc).

          I forget what the default is, but it's explained in the help file.


          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]