Closed Thread
Results 1 to 3 of 3

Thread: File writing

  1. #1
    Registered Senior Member Spectrum's Avatar
    Posts
    459

    File writing

    I need help writing to a file that is running. I am programming in QBasic but any advice would be welcome (preferably debug for windows (which I understand is an assembler)). My programs are as follows:

    open [THISFILENAME$] for random as #1
    while eof(1)=0
    get #1
    put #1
    wend
    close #1
    ...or...

    open [THISFILENAME$] for random as #1
    for address=1 to lof(1)
    get #1, address
    put #1, address
    next address
    close #1
    The programs above do write to the file but I have to close down the program to see what has been written. I want the data to be written to the file, not simply to memory.

  2. #2
    According to my quickreference (since I don't program in QBasic) you are missing something out from the initial file open:
    Code:
    OPEN [THISFILENAME$] for RANDOM AS #1 LEN = LEN(RecordVariable)
    I couldn't tell you if this is helpful at all, from what I can work out, using the RANDOM file access allows both Read and Write at the same time, you could try writing to a file using APPEND or OUTPUT to see whether or not your syntax is correct. (That's what I would try anyhow)

    The only other possibility is that you are using the #1 for more than one file access at a time and this could cause conflicts on closing.

  3. #3
    Registered Senior Member Spectrum's Avatar
    Posts
    459
    Stryder, thanks for your wise reply. However I get the same result when I use
    open [THISFILE$] for random as #1 len=1

Similar Threads

  1. By TruthSeeker in forum Business & Economics
    Last Post: 11-08-07, 04:17 PM
    Replies: 51
  2. By darksidZz in forum Computer Science & Culture
    Last Post: 07-31-07, 11:16 AM
    Replies: 3
  3. By Tiassa in forum Computer Science & Culture
    Last Post: 07-31-07, 11:02 AM
    Replies: 6
  4. By coberst in forum General Philosophy
    Last Post: 03-18-07, 03:51 PM
    Replies: 0
  5. By MewSkitty in forum Computer Science & Culture
    Last Post: 01-20-07, 05:58 PM
    Replies: 20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •