BBC BASIC for Windows
« writing to disk file »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:54pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: writing to disk file  (Read 668 times)
Wendell
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx writing to disk file
« Thread started on: Feb 13th, 2014, 01:55am »

workfl=OPENOUT("workfl1")
INPUT age


how would i write Age to workl1 file
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: writing to disk file
« Reply #1 on: Feb 13th, 2014, 02:48am »

on Feb 13th, 2014, 01:55am, Wendell wrote:
workfl=OPENOUT("workfl1")
INPUT age

how would i write Age to workl1 file

It depends on what the file is for.

If you are writing it to the file with the intention of reading it back in a BASIC program (in other words you are happy for it to be written in an internal, binary, format):

Code:
      workfl=OPENOUT("workfl1.dat")
      INPUT age
      PRINT #workfl, age 

If you are writing it with a view to the file being read by a different application, so you need to store it in a 'universal' format, then write it as a string and use a CRLF termination:

Code:
      workfl=OPENOUT("workfl1.txt")
      INPUT age
      PRINT #workfl, STR$(age)
      BPUT #workfl, 10 

Note that in each case I have emphasised the nature of the file by adding an explicit extension (.dat in the case of the binary file, .txt in the case of the ASCII file). Omitting the extension altogether isn't recommended, because it will default to .bbc and the file is likely to be mistaken for a BASIC program.

Richard.
User IP Logged

Wendell
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Re: writing to disk file
« Reply #2 on: Feb 13th, 2014, 05:04am »

thank you it worked
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls