BBS: Inland Empire Archive
Date: 01-23-93 (09:08)             Number: 353
From: STEVE CRAVER                 Refer#: NONE
  To: JOHN SNEERINGER               Recvd: NO  
Subj: Q-4-U!                         Conf: (2) Quik_Bas
* Originally addressed to All, John Sneeringer said:

JS->When opening a random file like the following...
JS->OPEN "r", 1, "a_file.dat", 64
JS->FIELD #1, 25 AS Fields$(1), 10 AS Fields$(2), 4 AS
JS->Fields$(3), blah

JS->Is there any abbreviation, or something that will allow me
JS->to continue a VERY long FIELD line on the next line in QuickBASIC?

Use TYPEs...
TYPE Fieldx   '<---------------------
   x AS STRING * 25  ' Fields$(1)   '| (or INTEGER, LONG, SINGLE, etc.)
   y AS STRING * 10  ' Fields$(2)   '|
   Z AS STRING * 3   ' Fields$(3)   '|
'   .                               '|
'   . etc.                          '|
'   .                               '|
END TYPE                            '|
DIM SHARED Fields AS Fieldx '>-------
'            ^-------------------------------------------------\
OPEN "A_FILE.DAT" FOR RANDOM AS 1 LEN = LEN(Fields)            '|
Entries = LOF(1) / LEN(Fields)  ' How many entries it contains '|
'     v--------------------------------------------------------/
   Fields.x = "It is easy."
   Fields.y = "to use the TYPE"
   Fields.z = "Ok?"
Entries = Entries + 1
PUT 1, Entries, Fields
GET 1, 1, Fields
   PRINT Fields.x
   PRINT Fields.y
   PRINT Fields.z
The output would look like:
It is easy
to use the  <----(remember, we only made it 10 charactors long!)
 * Origin: RadioLink! Columbus, OH (614)766-2162
QuickBasic! HST/DS (1:226/140)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET