Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.basic.misc > #230

Re: Opening a .DAT file

From ralph <nt_consulting64@yahoo.net>
Newsgroups comp.lang.basic.misc
Subject Re: Opening a .DAT file
Date 2012-03-12 13:28 -0500
Organization Aioe.org NNTP Server
Message-ID <vtfsl7tdbse10le3pf46q2ndbos551lkdr@4ax.com> (permalink)
References <46O6r.4324$v14.3046@viwinnwfe02.internal.bigpond.com> <XnsA012B7D72EAACauricauricauricauric@88.198.244.100> <uaq7r.4386$v14.4278@viwinnwfe02.internal.bigpond.com>

Show all headers | View raw


On Tue, 13 Mar 2012 04:14:53 +1100, "DonH" <donlhumphries@bigpond.com>
wrote:

>"Auric__" <not.my.real@email.address> wrote in message 
>news:XnsA012B7D72EAACauricauricauricauric@88.198.244.100...
>> DonH wrote:
>>
>>> Is this possible, to view contents on-screen?
>>>   QBasic enables data to be stored in a Sequential file, and you can use
>>> .TXT or .DAT as the storage unit.  But only .DAT is possible for storage
>>> as a Random Access file.
>>
>> Solving specifically this problem, you can use QBasic to read in the data
>> from the .dat file, then write it out to something else, e.g. a CSV file.
>> Something like this:
>>
>>  TYPE mydatatype
>>    a AS LONG
>>    b AS SINGLE
>>    c AS STRING * 30
>>  END TYPE
>>  DIM x AS mydatatype
>>  OPEN "foo.dat" FOR RANDOM AS 1
>>  OPEN "foo.csv" FOR OUTPUT AS 2
>>  WHILE NOT EOF(1)
>>    GET #1, , x
>>    WRITE #2, x.a, x.b, RTRIM$(x.c)
>>  WEND
>>  CLOSE
>>
>> (You'll need to tweak this to get the right type and number of fields, and
>> the correct size of any strings.)
>>
>> -- 
>> Sometimes I wish I'd held on to some of my illusions;
>> life's pretty bleak sometimes without them.
>
># Thanks for the TYPE program; similar examples I have already tried, only 
>to find that this facility did not seem available to me - until I removed 
>line numbers!
>   It was only when experimenting with another relatively modern statement 
>ie. SELECT CASE that the QBasic error message tipped me off; it too won't 
>work with line numbers present.
>  Incidentally, what does CSV represent? 
>

"Comma Separated Values". Your basic delimited data exchange format.

http://en.wikipedia.org/wiki/Comma-separated_values

-ralph

Back to comp.lang.basic.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Opening a .DAT file "DonH" <donlhumphries@bigpond.com> - 2012-03-11 06:39 +1100
  Re: Opening a .DAT file "Auric__" <not.my.real@email.address> - 2012-03-11 01:04 +0000
    Re: Opening a .DAT file "DonH" <donlhumphries@bigpond.com> - 2012-03-13 04:14 +1100
      Re: Opening a .DAT file H-Man <Spam@bites.fs> - 2012-03-12 12:25 -0600
      Re: Opening a .DAT file ralph <nt_consulting64@yahoo.net> - 2012-03-12 13:28 -0500
  Re: Opening a .DAT file Todd Vargo <tlvargo@sbcglobal.netz> - 2012-03-11 09:45 -0500
    Re: Opening a .DAT file "DonH" <donlhumphries@bigpond.com> - 2012-03-13 04:29 +1100
      Re: Opening a .DAT file Todd Vargo <tlvargo@sbcglobal.netz> - 2012-03-12 16:12 -0500
        Re: Opening a .DAT file "DonH" <donlhumphries@bigpond.com> - 2012-03-14 05:47 +1100
          Re: Opening a .DAT file Todd Vargo <tlvargo@sbcglobal.netz> - 2012-03-13 17:18 -0500
            Re: Opening a .DAT file H-Man <Spam@bites.fs> - 2012-03-13 15:38 -0600
          Re: Opening a .DAT file "R.Wieser" <address@not.available> - 2012-03-15 22:48 +0100

csiph-web