10-01-2022, 11:45 PM
I haven't found anything about deleting records in a sequential file now.
I once created a relational database in Cobol with insert, change, delete, and later a doubly linked list in C, and it could do that too. But it's been a long time. There doesn't seem to be anything like that in Basic?
A simple example for a sequential file:
I once created a relational database in Cobol with insert, change, delete, and later a doubly linked list in C, and it could do that too. But it's been a long time. There doesn't seem to be anything like that in Basic?
A simple example for a sequential file:
Code: (Select All)
'Beispiel sequentielle Datei - 2. Okt. 2022
Option _Explicit
Dim As String Firma, NameWare, Farbe, Menge
'Neue Datei erstellen - Create file
Open "Preis.Dat" For Output As #1
Do
Input "Firma: ", Firma
If Firma <> " " Then
Input "Ware : ", NameWare
Input "Farbe: ", Farbe
Input "Menge: ", Menge
'Write in the file
Write #1, Firma, NameWare, Farbe, Menge
End If
Loop Until Firma = " " 'End if spacebar -> Enter
Close #1
End
'Read in the file. - Not testet.
Open "Preis.Dat" For Input As #1
'Show the file
Print "Anzeige aller Artikel"
Do Until EOF(1)
Input #1, Firma, NameWare, Farbe, Menge
Print Firma, NameWare, Farbe, Menge
Loop
'Insert data into a sequential file - Not testet
Open "Preis.Dat" For Append As #1