QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: MWheatley on May 27, 2020, 12:23:43 pm

Title: Reading data from data files
Post by: MWheatley on May 27, 2020, 12:23:43 pm
Gosh!  It's over 30 years since I last wrote some BASIC to pull in a stream of numbers from a file.

The resulting program must (for reasons that are too complicated to explain) be QB45 compatible, although it will also be run under QB64.

So... are there any tricks to getting QB to navigate to a file's location?  Are there any libraries out there that do this?

Trivially simple for modern-era code, I suppose, but we're talking old school here.

TIA

Malcolm
Title: Re: Reading data from data files
Post by: TerryRitchie on May 27, 2020, 12:32:35 pm
This may be a place to begin. In this section of my tutorial I outline file input/output and drive navigation.

http://qb64sourcecode.com/task13.html
Title: Re: Reading data from data files
Post by: Petr on May 27, 2020, 04:20:31 pm
I'm not sure if there is also an example in the tutorial with the INPUT$ function, this is the right function, that definitely works properly for reading binary files in both QB 4.5 and QB64.
Title: Re: Reading data from data files
Post by: TerryRitchie on May 27, 2020, 04:59:19 pm
I'm not sure if there is also an example in the tutorial with the INPUT$ function, this is the right function, that definitely works properly for reading binary files in both QB 4.5 and QB64.

You're correct. In the old version of the tutorial I included INPUT$ with a demo of how to use it as a hidden password entry field. I'll make a note to add INPUT$ to task 13 with examples. Thanks for pointing that out.
Title: Re: Reading data from data files
Post by: MWheatley on May 27, 2020, 05:18:24 pm
I'm not sure if there is also an example in the tutorial with the INPUT$ function, this is the right function, that definitely works properly for reading binary files in both QB 4.5 and QB64.

That's useful, as I had explicitly ruled out INPUT$ in favor of LINE INPUT. Looks like I need to do more reading!

Malcolm
Title: Re: Reading data from data files
Post by: MWheatley on May 29, 2020, 05:44:41 am
This may be a place to begin. In this section of my tutorial I outline file input/output and drive navigation.

http://qb64sourcecode.com/task13.html

Thanks, Terry.  That was very useful.  I didn't know about some of those new QB64 commands.

Malcolm