GET#: Your File and Device Manager

GET#: Your File and Device Manager

Want to read data from files or devices character by character? GET# is your go-to command! This handy tool lets you fetch individual characters from a specified file or device, giving you granular control over input and the ability to process data as it arrives. Think of it as your communication conduit to the world beyond your keyboard!

Syntax

GET# <file number>, <string variable>

Where:

  • <file number>: The logical file number (1-255) assigned to the file or device when you opened it using OPEN.
  • <string variable>: A string variable (ending in $) that will store the captured character.

Applications

The GET# command is your friend when:

  • Reading from files: Process text files, configuration files, or data logs one character at a time.
  • Communicating with devices: Receive input from modems, printers, or custom hardware interfaces.
  • Creating interactive programs: Build applications that respond to real-time input from external sources.

Code Examples

1. Reading from a File:

10 OPEN 1,8,8,"myfile,S,R"  :rem Open a sequential file for reading
20 GET#1, C$                :rem Read a character into C$
30 IF C$<>"" THEN PRINT C$; :rem Print the character if not end of file
40 GOTO 20                  :rem Read the next character

This loop reads and prints the contents of a file character by character until the end of the file is reached.

2. Receiving Data from a Modem:

10 OPEN 1,1,1,"RS232:C1200" :rem Open a serial port for communication
20 GET#1, C$
30 IF C$<>"" THEN PRINT C$;
40 GOTO 20

This example waits for incoming characters from a modem connected to the RS-232 port and displays them on the screen.

GET# in the Wild: The Commodore 64 Teleprompter

Imagine you're giving a presentation and want to use your C64 to display your script. You could store the text in a file and use GET# to read and display the characters one by one, creating your own personal teleprompter!

Don't be limited by the keyboard! With GET#, you can unlock a world of data sources and external devices, creating programs that interact with the world around them. It's like having a universal translator for your Commodore 64, allowing it to communicate with all sorts of hardware and software. So go forth and explore the power of GET# – the possibilities are endless!


Privacy Policy

Let's be honest, we collect some data. But we promise not to sell it, we'll mostly use it to improve our service. You can read the nitty-gritty details below, but be warned, it uses big words that lawyers like (we don't judge).

By using our service, you agree to this privacy policy. This disclaimer strikes a balance between lightheartedness and informing users that they should still read the full privacy policy if they choose.