Converts a specified character of a given string into the ASCII code equivalent.


variable = asc(A$,n)

Where A$ is a string variable and N defines which character in the string we are interested in.


ASC is a library function that must be included before it can be used. Use the following directive:

#include <asc.bas>


  • This function is for FreeBASIC compatibility. See FreeBasic - ASC for details.
  • The return on this function is generally identical to that of CODE(A$(n)), though it will return 0, not an error, if invoked to return the ascii code of a character beyond the length of the string.

See also