20 Texte in eine Datei? In 20 Dateien? Oder Datenbank?

Anfängerfragen zum Programmieren mit PureBasic.
ShadowTurtle
Beiträge: 114
Registriert: 11.09.2004 07:58
Wohnort: Mannheim
Kontaktdaten:

Beitrag von ShadowTurtle »

Ich habe mal / durch den typischen ascii zeilenumbruch code (13) ersetzt. Bei [ und ] habe ich jeweils 14 und 15 benutzt.

Code: Alles auswählen

ReadFile(0,"Text.txt")
text$ = ReadString()
lpos = 0
Dim text.s(20)
For b = 0 To 19
  If lpos = 0
    pos1 = FindString(text$,Chr(14),1)
    pos2 = FindString(text$,Chr(13),1)
    lange = pos2 - pos1 - 1
    text(0) = Mid(text$,pos1 + 1,lange)
  Else
    pos1 = FindString(text$,Chr(13),lpos)
    pos2 = FindString(text$,Chr(13),lpos + 1)
    lange = pos2 - pos1 - 1
    text(b) = Mid(text$,pos1 + 1,lange)
  EndIf
  If b = 15
    pos1 = FindString(text$,Chr(13),lpos)
    pos2 = FindString(text$,Chr(15),lpos)
    lange = pos2 - pos1 - 1
    text(19) = Mid(text$,pos1 + 1,lange)
  EndIf
  lpos = pos2
Next b
Antworten