Inside a BEGIN STORAGE...END STORAGE
block, the FILE
command plays
a crucial role in the process of embedding external data directly into the
storage medium you are defining while compiling your program. Imagine you
want to include a set of configuration data or any other static file
directly into your program's storage medium, the FILE
command allows
you to do just that.
The basic syntax is to indicate the name of the source file that will be
inserted into the media. If you do not want to use the same name, you can
indicate an alias (AS target
).
The addition of the CSV OF type
statement is a powerful feature that
allows you to include Comma Separated Values (CSV) files and specify the
data type of each column. Instead of treating the CSV file as a simple
block of bytes (as the FILE
statement alone would), the compiler will
parse the contents of the CSV file and convert it into a more structured
internal representation that is ready for use by your program. The kind
of structure will be described by the datatype type
.
FILE source [AS target] [CSV OF type]
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
FILE (storage) ↔ FILE
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS