as a optional parameter in the compiler options (default off).
so instead of
Code:
ofile=OpenFile(#PB_Any, "Test.txt") ; öffnet eine existierende Datei oder erstellt eine, wenn sie noch nicht existiert
If ofile
FileSeek(ofile, Lof(0)) ; springt an das Ende der Datei (das Ergebnis von Lof() wird hierfür verwendet)
WriteStringN(ofile, "... another line at the end.")
CloseFile(ofile)
EndIf
it should be
Code:
ofile=OpenFile( "Test.txt") ; öffnet eine existierende Datei oder erstellt eine, wenn sie noch nicht existiert
If ofile
FileSeek(ofile, Lof(0)) ; springt an das Ende der Datei (das Ergebnis von Lof() wird hierfür verwendet)
WriteStringN(ofile, "... another line at the end.")
CloseFile(ofile)
EndIf
Maybe it is possible to use it as an optional parameter.
maybe it would be nice something like this:
Code:
if openfile(@ofile,"test.txt")
FileSeek(ofile, Lof(0)) ; springt an das Ende der Datei (das Ergebnis von Lof() wird hierfür verwendet)
WriteStringN(ofile, "... another line at the end.")
CloseFile(ofile)
EndIf
at the moment something linke this is possible:
Code:
Procedure.i myreadfile(*var.integer,file$)
*var\i=ReadFile(#PB_Any,file$)
ProcedureReturn *var\i
EndProcedure
Macro ReadFile(a,b)
myreadfile(@a,b)
EndMacro
If ReadFile(ofile, "Test.txt")
Debug "gefunden!"+Str(ofile)
CloseFile(ofile)
Else
Debug "das war nichts"
EndIf
If ReadFile(ofile, "c:\windows\directx.log")
Debug "gefunden!"+Str(ofile)
CloseFile(ofile)
Else
Debug "das war nichts"
EndIf