opening and parsing local computer files

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
wulftone
Posts: 5
Joined: 25 April 2011, 15:44 PM

opening and parsing local computer files

Post by wulftone »

Hi,

So, the PlaySound routine opens a file from the local drive and inserts the data into the program. I'd like to do this but parse a text file (really, a YAML file) and create variables according to what's in the file. I haven't the foggiest clue how to start doing this except some vague notion that I'll probably need to use a "Program Memory Data Item" as described in section 2.10 of the ZBasic Reference manual. Where do I go from there?

Thanks!
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: opening and parsing local computer files

Post by dkinzer »

wulftone wrote:So, the PlaySound routine opens a file from the local drive and inserts the data into the program.
Not quite. The PlaySound routine simply uses a block of data from Program Memory containing the sound data to recreate the sound waveform. How that block of data gets created/defined is a completely separate issue.
wulftone wrote:I'd like to do this but parse a text file (really, a YAML file) and create variables according to what's in the file.
For this, you'll have to write a program to run on your PC to convert the data in the YAML file to one or more data files. The format of the data file will likely be in the form of initialization data for Program Memory Data Items.

Perhaps you could describe the content of the YAML file and the types of data you intend to extract from it. With that, someone may be able to show some example code.
- Don Kinzer
Post Reply