How do you get the ascii value of each digit of a long?
Trying to get the values without using the string handling routines.
Trying to get the values without using the string handling routines.
Code:
#COMPILE EXE #DIM ALL DECLARE FUNCTION ShowDate(month AS LONG, day AS LONG, year AS LONG) AS STRING FUNCTION PBMAIN AS LONG LOCAL month, day, year AS LONG DIM s AS STRING s = "00/00/0000" month = 11 day = 12 year = 9473 ? ShowDate(month, day, year) WAITKEY$ END FUNCTION FUNCTION ShowDate (month AS LONG, day AS LONG, year AS LONG) AS STRING LOCAL s AS STRING s = "00/00/0000" ASC(s,1) = month \10 +48 ASC(s,2) = month MOD 10 + 48 ASC(s,4) = day\10 + 48 ASC(s,5) = day MOD 10 + 48 ASC(s,7) = year\1000 +48 'ASc(s,8) = 'asc(s,9) = 'asc(s,10) = FUNCTION = s END FUNCTION
Comment