Help

Blitz3D Forums/Blitz3D Programming/Help

asdfasdf(Posted 2004) [#1]
Can somebody tell me and/or fix this code so it will not say 'Stream does not exist'. This writes a file called '(your file name).inf' and a file called '(your file name).log'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;LogFile.bb
;Contains Functions to write .log files
;WARNING:
;You must create a Global called 'LogName$' For these to work
;Call Function SetLogName() first unless you have declared it in the program start up
;Call Function WriteLogFile() second unless you already have the file written
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Function WriteLog(St$)

file = ReadFile(FileName$ + ".inf")

LogName$ = ReadString$(file)

CloseFile(file)

file = OpenFile(LogName$)

WriteString(file,st$)

CloseFile(file)

End Function

Function WriteLogFile(FileName$)

file = ReadFile(FileName$ + ".inf")

LogName$ = ReadString$(file)

CloseFile(file)

file = WriteFile(LogName$)

CloseFile(file)

End Function

Function SetLogName(File$)

file = WriteFile(FileName$ + ".inf")

WriteString(file,FileName$ + ".log")

End Function

File 2:
Include "LogFile.bb" ;That is the name of the file above
SetLogName("example")
WriteLogFile("example")
WriteLog("Hello")

Thanks
I have figured it out.


GfK(Posted 2004) [#2]
Change:
Function WriteLog(St$)
to
Function WriteLog(FileName$)
and
Function SetLogName(File$)
to
Function SetLogName(FileName$)
Also, try to make your thread title a little more descriptive than "help" in future.