Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - chr() convert an ascii code to a character http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 chr()               Convert an ASCII code to a character
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char chr extern
   param value uint uASCII

 Arguments
   uASCII is an ASCII character code.

 Return
   String representation of the passed code.

 Description
   The chr() function returns a character string of length 1 with the
   character derived from the ASCII value of uASCII.

   chr( 0 ) returns an empty string because the NULL byte is used to indicate
   the end of a string. If there is a need to send a NULL character to a
   printer, use the fbwrite() function.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   proc Test_chr
   vardef
      uint nRow, nCol
      uint uChar
   enddef
   
   // sound an alert if there is a printer error
   if .not. pready()
      ? chr( 7 )                   // sound the bell
      wait "Printer not ready. Press a key to continue..."
   endif
   
   // print out an ASCII table
   clear
   store 0 to nRow, nCol
   for uChar := 0 to 255
      @ nRow, nCol ?? chr( uChar )
      nCol++
      if nCol >= __max_col
         nCol := 0
         nRow++
      endif
   next
   endproc

   proc main
   Test_chr()
   endproc

See Also: asc() istr()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson