shortening my sequencing records without writing each record
#12
(09-27-2022, 09:00 PM)babyboomerboy Wrote: I have a program that writes a series of numbers to a file that I can recall. The problem is I have to go into the program each time I want to write a different record. 
OPEN "RECORD16.DAT" FOR OUTPUT AS #1
FOR TTP = 1 TO 8
    FOR X = 1 TO 3
        PRINT #1, ALINE(X, TTP)
        PRINT #1, TIME(X, TTP)
    NEXT X
NEXT TTP
CLOSE #1

I want to be able to make a new record :record16.dat without going to the program and changing it, 
record 17.dat, or record18.dat or whatever. I also want to be able to recall this new record. 
I hope I was able to explain this for someone to understand how I can add to my data base without doing it manually. Thank you

Oh heck you just want to change file name. 

Code: (Select All)
Input "Enter record number or nothing to quit "; recordNumber$
If recordNumber$ <> "" Then
    Filename$ = "RECORD" + recordNumber$ + ".DAT"
    Open Filename$ For Output As #1
    For TTP = 1 To 8
        For X = 1 To 3
            Print #1, ALINE(X, TTP)
            Print #1, TIME(X, TTP)
        Next X
    Next TTP
    Close #1
End If


For recall, depending what you want? This will both show the record and save it into an array for manipulation if desired.

Code: (Select All)
Input "Enter record number to Recall, or nothing to quit "; recordNumber$
If recordNumber$ <> "" Then
    Filename$ = "RECORD" + recordNumber$ + ".DAT"
    Dim aline(1 To 3, 1 To 8) As String
    Dim tyme(1 To 3, 1 To 8) As String
    Open Filename$ For Input As #1
    For TTP = 1 To 8
        For X = 1 To 3
            'show each line and load into an array
            Line Input #1, aline(X, TTP) ' use line input in case of commas  input into an array in case want to manipulate later
            Print aline(X, TTP)
            Line Input #1, tyme(X, TTP)
            Print tyme(X, TTP)
        Next X
    Next TTP
    Close #1
End If


PS I could not DIM Time as an array because it is a QB64 Keyword.
b = b + ...
Reply


Messages In This Thread
RE: shortening my sequencing records without writing each record - by bplus - 10-02-2022, 04:48 PM



Users browsing this thread: 8 Guest(s)