| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
If the file_number was never opened (or was opened but then closed), GET# will generate FILE NOT OPEN ERROR. If the "file" does not have data available, GET# will assign zero to a numeric variable or a zero-length string to a string variable. A "bug" in all versions of CBM BASIC is that a character with code zero (a.k.a. CHR$(0), a.k.a. "null") is stored into a string variable as a zero-length string instead of a 1-character string with code zero. This is especially important for BASIC versions before 3.5 because they will generate an error with the ASC function if the string is empty (zero length). GET# may only be used as a statement in a program. Outside of a program it will generate ILLEGAL DIRECT error. If flie_Number is omitted or no variables are specified, GET# will generate SYNTAX ERROR. Trivia: the GET# keyword is actually the token GET followed by the ASCII code for "#" which means that (unlike most statments) you may include a space in the "keyword" (but only between GET and #). Example:
The above example is pretty silly because you don't need to use OPEN/CLOSE to GET from the keyboard; however it is the only example I can think of that will work on all CBMs.
© H2Obsession, 2014 |