News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Bryce

BASIC Question - Creating a Data File.

Started by Bryce, 21:22, 16 October 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bryce

Hi All,
       I decided to refresh my BASIC skills (or lack of them). I fished out all my old BASIC Progs from my youth and have decided to update some of them. Here's my (current) problem, that maybe someone can solve for me:

I have a database program that reads data from a file using the standard openin/openout. I don't have the original data file any more, but I do have the same data on the PC as a CSV file. How can I get this file back to a DAT file, is there any way to convert the file, copy/paste it or do I have to type it all in again? I have a basic program to manually input the data, but that would take ages.

Bryce.

SyX

I don't remember how the basic storage the datas in the file (sequential, i suppose), but if you insert a pair of records with your basic program and give me the DAT file generated and a pair of lines of the CSV file, i could hack a python program to convert from your CSV file to DAT ;)

Other option is precede every line of the CSV file with DATA, go to WinApe write "auto 10,10", then select autotype and paste the CSV file (use frameskip 50 and turbo mode for accelerate the process), when is finished you can add a routine to READ from the DATA lines and write in the DAT file ;) (other variation of this technique is reorganizing the CSV file, paste in auto type and you could use your INPUT program to insert the datas automatically)

ralferoo

My approach would be to use something like 2cdt to turn the CSV file into a binary tape image. Load that into memory and then use peek to read the data and write it back to a file on disk using openout. It's probably also possible to skip the peeking and create a stream tape file directly, but I don't know the specifics of how it encodes the data (at the very least, it'd use a different file type byte).

It's also possible you might not have much success with 2cdt as distributed. I basically rewrote the innards of it because it did something wrong (although I can't remember what), so if it doesn't do what you need, I can package up my source tree for that.

HAL6128

The openin/openout command read datas in sequence. Each data will be seperated with an &13 (Return?) - but I'm not sure about that.
It depends how is the CSV-file built. If the datas are among each other just copy the datas into notepad and save the file as an ASCII, and put on as DSK via ManageDSK?
...proudly supported Schnapps Demo, Pentomino and NQ-Music-Disc with GFX

Zetr0

Well this is very interesting,

After spending this last week in Hospital I managed to get some reading done, one of them was the Amstrad CPC464 Intruction to programming manual...

just refreshing my memory and I shall post back shortly =D
If I had a hammer.....

Powered by SMFPacks Menu Editor Mod