Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the enter key for CHR$
#1
I have been trying to find out the CHR$ Value for ENTER but I can seem to get it, any help please?
Reply
#2
chr$(13)
Reply
#3
In dos/win it's 13 followed by a 10 ( carrige return + line feed ).
In *nix it's just 13 (or was it 10?)
oship me and i will give you lots of guurrls and beeea
Reply
#4
yes, if you do an inkey$ youll get a chr$(13), but like blitz said... if you were for instance to go into notepad, make a newfile, hit enter, and save it, then open that file in binary mode, youd read a 13, then a 10.

dunno what youre using it for so i figured id say that ;p
Reply
#5
Hi, some time ago, I made a small, exe file from QuickBASIC, which I call ASCII2.EXE. It shows, in five screens, with Previous Screen, Nest Screen, and Quit available in each, all the 127 ASCII characters (those that Killer referred to as CHR$ characters), as well as the 127 IBM Extended characters, plus two screens with only the box-making characters, helpfully arranged.

I made a shortcut to it, which I keep handy, for an easy reference to the code characters.

If somebody is interested in a free copy, just send me a PM with your email address, and I'll attach a copy.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#6
i think you should send source as opposed to an exe, no offense, its just better protocol in this environment, imo

especially since i dont think its going to make you any money ;)
Reply
#7
[syntax="qbasic"]
SCREEN 10

DO
a$ = ""
a$ = INKEY$ '' Speed up the keyboard buffer by dumping it to a variable
scan% = INP(&H60)

IF (LEN(a$)) THEN
CLS
PRINT "Key Pressed :: Character code: "; ASC(a$)
PRINT SPACE$(14); "Scan Code:" SPACE$(7); scan%
END IF

LOOP UNTIL (a$ = CHR$(27) '' Conveniently "Esc"

SCREEN
END
[/syntax]

THat should help you find any scan/CHR$ code you want

Oz~
Reply
#8
im guessing the the character code can be utilized with
CHR$(i)
but what about scan code?
ASC(i)?
quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Reply
#9
To view the complete ASCII character set within QuickBASIC 4.5, click on Help, Contents, and select the second-to-last selection, <ASCII Character Codes>. You will see the full ASCII code (0-127), as well as the IBM Extended Character code (128-255).

Also, if you select the last selection there, <Keyboard Scan Codes>, you will see those.

Another way to get to the ASCII Character Codes is to simply enter ASC and then F1, and double-click on <ASCII Character Codes>, at the bottom of that screen.

A third way is to use my ASCII2.EXE. Or, if someone wants it, my ASCII2.BAS.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#10
Source code? O.K., for what it's worth:

Code:
DECLARE SUB CENTER (A$)

SCREEN1:
COLOR 1, 15
CLS
PRINT
CENTER "SCREEN 1"
PRINT " ASCII is a free program, made in 1995 by Ralph A. Esquivel.  Tel. 281-392-2749."
PRINT " Here are the 127 ASCII Code numbers and characters, then the IBM extended cha- "
PRINT " racter set, followed by the group of box-formaing characters from this set.    "
PRINT
CENTER " CHARACTERS 0-31 OF THE ASCII CODE, CALLED THE CONTROL CHARACTERS"
CENTER " ----------------------------------------------------------------"
PRINT "  0 NUL=Null, 1 SOH=Start Of Heading, 2 STX=Start Of Text, 3 ETX=End Of Text    "
PRINT "  4 EOT=End Of Transmission, 5 ENQ=Enquiry, 6 ACK=Acknowledge, 7 BEL=Bell       "
PRINT "  8 BS=BackSpace, 9 HT=Horizontal Tab, 10 LF=Line Feed, 11 VT=Vertical Tab      "
PRINT " 12 FF=Form Feed, 13 CR=Carriage Return, 14 SO=Shift Out, 15 SI=Shift In        "
PRINT " 16 DLE=Data Link Escape (send to printer), 17 DC1=Device Control 1, 18 DC2     "
PRINT " 19 DC3=(pause), 20 DC4, 21 NAK=Negative Acknowledge, 22 SYN=Synchronous idle   "
PRINT " 23 ETB=End of Transmission Block, 24 CAN=Cancel, 25 EM=End of Medium           "
PRINT " 26 SUB=Substitute, 27 ESC=Escape, 28 FS=File Separator,29 GS=Group Seperator   "
PRINT " 30 RS=Record Seperator, 31 US=Unit Separator            "

LOCATE 23, 1
CENTER "Press <Esc> for Previous Screen, <Enter> to continue, <Q> to Quit."
K$ = "": WHILE K$ = "": K$ = UCASE$(INKEY$): WEND
IF K$ = CHR$(27) THEN GOTO SCREEN5
IF K$ = "Q" THEN END

'===========================================================================

SCREEN2:
CLS
PRINT
CENTER "SCREEN 2"
CENTER " CHARACTERS 32-127 OF THE ASCII CODE, THE ALPHA-NUMERIC CHARACTERS"
CENTER " -----------------------------------------------------------------"
PRINT SPACE$(12);
FOR I = 32 TO 127
  IF I MOD (10) = 0 THEN PRINT
  PRINT I;
  PRINT CHR$(I); " ";
NEXT

LOCATE 23, 1
CENTER "Press <Esc> for Previous Screen, <Enter> to continue, <Q> to Quit."
K$ = "": WHILE K$ = "": K$ = UCASE$(INKEY$): WEND
IF K$ = CHR$(27) THEN GOTO SCREEN1
IF K$ = "Q" THEN END
'end of SCREEN2

'===========================================================================

SCREEN3:
CLS
PRINT
CENTER "SCREEN 3"
CENTER " THE IBM EXTENDED 128-CHARACTER SET CONTAINED IN DOS & WINDOWS"
CENTER " -------------------------------------------------------------"
FOR I = 128 TO 255
  IF I MOD (8) = 0 THEN PRINT
  PRINT I;
  PRINT CHR$(I); " ";
NEXT

LOCATE 23, 1
PRINT "Press <Esc> for Previous Screen, <Enter> to continue, <Q> to Quit."
K$ = "": WHILE K$ = "": K$ = UCASE$(INKEY$): WEND
IF K$ = CHR$(27) THEN GOTO SCREEN2
IF K$ = "Q" THEN END
'end of SCREEN3

'===========================================================================

SCREEN4:
CLS
'Following forms are taken from Supercharging MS-DOS, by Van Woverton, p. 266
PRINT
CENTER "SCREEN 4"
CENTER " BOX-MAKING CHARACTERS FROM THE IBM EXTENDED SET"
CENTER " -----------------------------------------------"
PRINT "        203        |        209        |        210        |        194"
PRINT " 201 "; CHR$(201); "   "; CHR$(203); "   "; CHR$(187); " 187 |";
PRINT " 214 "; CHR$(214); "   "; CHR$(210); "   "; CHR$(183); " 183 |";
PRINT " 218 "; CHR$(218); "   "; CHR$(194); "   "; CHR$(191); " 191 |";
PRINT " 213 "; CHR$(213); "   "; CHR$(209); "   "; CHR$(184); " 184  "
PRINT "                   |                   |                   |  "
PRINT "                   |                   |                   |  "
PRINT " 204 "; CHR$(204); "   "; CHR$(206); "   "; CHR$(185); " 185 |";
PRINT " 199 "; CHR$(199); "   "; CHR$(215); "   "; CHR$(182); " 182 |";
PRINT " 195 "; CHR$(195); "   "; CHR$(197); "   "; CHR$(180); " 180 |";
PRINT " 198 "; CHR$(198); "   "; CHR$(216); "   "; CHR$(181); " 181  "
PRINT "        206        |        215        |        197        |        216"
PRINT "                   |                   |                   |  "
PRINT " 200 "; CHR$(200); "   "; CHR$(202); "   "; CHR$(188); " 188 |";
PRINT " 211 "; CHR$(211); "   "; CHR$(208); "   "; CHR$(189); " 189 |";
PRINT " 192 "; CHR$(192); "   "; CHR$(193); "   "; CHR$(217); " 217 |";
PRINT " 212 "; CHR$(212); "   "; CHR$(207); "   "; CHR$(190); " 190  "
PRINT "        202        |        208        |       "
PRINT "-------------------|-------------------|-------------------|-------------------"
PRINT " 205 "; CHR$(205); "   "; " "; "   "; CHR$(186); " 186 |";
PRINT " 196 "; CHR$(196); "   "; " "; "   "; CHR$(186); " 186 |";
PRINT " 196 "; CHR$(196); "   "; " "; "   "; CHR$(179); " 179 |";
PRINT " 205 "; CHR$(205); "   "; " "; "   "; CHR$(179); " 179  "
PRINT "-------------------|-------------------|-------------------|-------------------"

PRINT " Sample Boxes:"
S = 7: R = 8: T = 7
PRINT "-------------------|-------------------|-------------------|-------------------"
PRINT SPACE$(S); CHR$(201); CHR$(205); CHR$(203); CHR$(205); CHR$(187); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(214); CHR$(196); CHR$(210); CHR$(196); CHR$(183); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(218); CHR$(196); CHR$(194); CHR$(196); CHR$(191); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(213); CHR$(205); CHR$(209); CHR$(205); CHR$(184)

PRINT SPACE$(S); CHR$(186); " "; CHR$(186); " "; CHR$(186); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(186); " "; CHR$(186); " "; CHR$(186); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(179); " "; CHR$(179); " "; CHR$(179); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(179); " "; CHR$(179); " "; CHR$(179)

PRINT SPACE$(S); CHR$(204); CHR$(205); CHR$(206); CHR$(205); CHR$(185); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(199); CHR$(196); CHR$(215); CHR$(196); CHR$(182); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(195); CHR$(196); CHR$(197); CHR$(196); CHR$(180); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(198); CHR$(205); CHR$(216); CHR$(205); CHR$(181)

PRINT SPACE$(S); CHR$(186); " "; CHR$(186); " "; CHR$(186); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(186); " "; CHR$(186); " "; CHR$(186); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(179); " "; CHR$(179); " "; CHR$(179); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(179); " "; CHR$(179); " "; CHR$(179)

PRINT SPACE$(S); CHR$(200); CHR$(205); CHR$(202); CHR$(205); CHR$(188); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(211); CHR$(196); CHR$(208); CHR$(196); CHR$(189); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(192); CHR$(196); CHR$(193); CHR$(196); CHR$(217); SPACE$(S); "|";
PRINT SPACE$(S); CHR$(212); CHR$(205); CHR$(207); CHR$(205); CHR$(190)


LOCATE 23, 1
CENTER "Press <Esc> for Previous Screen, <Enter> to continue, <Q> to Quit."
K$ = "": WHILE K$ = "": K$ = UCASE$(INKEY$): WEND
IF K$ = CHR$(27) THEN GOTO SCREEN3
IF K$ = "Q" THEN END
'end of SCREEN4

'===========================================================================

SCREEN5:
CLS
'Following forms are taken from BEAM.BAS, by invent.ware,com, c. 1995
PRINT
CENTER "SCREEN 5"
CENTER " SOME NICE, SMOOTH LINES, USING PRE-EXISTING STRING ELEMENTS, AS SHOWN"
CENTER " ---------------------------------------------------------------------"
PRINT "   Elements   Example         Elements  Example"
PRINT "  Ã‰ Í Í Í »   ÉÍÍÍÍ»         Ú Ä Ä Ä ¿  ÃšÃ„ÄÄÄ¿"
PRINT "              Âº    Âº                    Â³    Â³"
PRINT "  Âº       º   º    Âº         ³       ³  ÃƒÃ„ÄÄÄ´"
PRINT "              Âº    Âº                    Â³    Â³"
PRINT "  Âº       º   ÈÍÍÍͼ         Ã Ä Ä Ä ´  Ã€Ã„ÄÄÄÙ"
PRINT
PRINT "  Âº       º                  Â³       ³"
PRINT
PRINT "  Ãˆ Í Í Í ¼                  Ã€ Ä Ä Ä Ù"

LOCATE 23, 1
CENTER "Press <Esc> for Previous Screen, <Enter> to continue, <Q> to Quit."
K$ = "": WHILE K$ = "": K$ = UCASE$(INKEY$): WEND
IF K$ = CHR$(27) THEN GOTO SCREEN4
IF K$ = "Q" THEN END
GOTO SCREEN1
'end of SCREEN 5

'=============================================
SUB CENTER (A$)
  PRINT SPACE$(38 - LEN(A$) / 2); A$
END SUB

Sorry that I couldn't get SCREEN 5 to show up properly Sad It uses some special characters that I could not reproduce here, even though it's very clear in the QuickBASIC 4.5 design environment. I don't even know how to reproduce the lines in SCREEN 5, except by copying the actual lines, as I did from a friend's program.

Perhaps, if I send the code as an attachment, the reciever might help out here.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)