Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a plain text file in GW-BASIC 2.01?

Tags:

gw-basic

My dad learnt programming in the 80s and he is still stuck with GW-BASIC (and making a living out of it). He was asked to create a CSV file, but he only knows how to create files of fixed-width records.

I found on the web that the syntax for opening plain-text files is:

OPEN file$ FOR OUTPUT as #1

but he claims it doesn't work. The interpreter he uses is the version 2.01. According to Wikipedia, the most "modern" version is 3.23 (1988).

Does anyone know how to create a plain-text file in such an outdated version of GW-BASIC?

like image 459
Roberto Bonvallet Avatar asked Nov 27 '09 23:11

Roberto Bonvallet


2 Answers

I can confirm that:

OPEN "FOO.TXT" FOR OUTPUT AS #1

was the syntax used to create text file FOO.TXT in GW-BASIC.

If that command did not exist in version 2.01 probably there wasn't any way to do this in that version. EDIT: I was wrong, see marg's answer. It existed but with a more difficult syntax to remember.

If your father saved the program in which he has to create this file this as ASCII:

SAVE "PROG.BAS",A

Then it is likely that he would be able to load it in any of GW-BASIC 3.32, QBASIC, QuickBASIC, and perhaps even Visual Basic, and then be able to use this command.

like image 59
Pascal Cuoq Avatar answered Sep 21 '22 07:09

Pascal Cuoq


I Downloaded 2.01 here and used the command:

open "o",#1,"test.txt" 

from this site.

like image 44
marg Avatar answered Sep 21 '22 07:09

marg