stream does not exist error
Blitz3D Forums/Blitz3D Beginners Area/stream does not exist error
| ||
when i got my hands on the source code of a game made in blitz max with the blitz3d SDK, i tried to run it and an error popped up that said "stream does not exist" and highlighted "while not eof (f)" is there a way to fix it? |
| ||
f is the previously opened stream, probably a file. Make sure it does indeed exist. |
| ||
Function GetINIString$(file$, section$, parameter$) Local TemporaryString$ = "" Local f = ReadFile(file) While Not Eof(f) If Lower(ReadLine(f)) = "[" + Lower(section) + "]" Then Repeat TemporaryString = ReadLine(f) If Lower(Trim(Left(TemporaryString, max(Instr(TemporaryString, "=") - 1, 0)))) = Lower(parameter) Then CloseFile f Return Trim( Right(TemporaryString,Len(TemporaryString)-Instr(TemporaryString,"=")) ) EndIf Until Left(TemporaryString, 1) = "[" Or Eof(f) CloseFile f Return "" EndIf Wend CloseFile f End Function this is the function it was in. |
| ||
Function GetINIInt$(file$, section$, parameter$) Local Stri$= Trim(GetINIString(file$, section$, parameter$)) If Lower(Stri) = "true" Then Return 1 ElseIf Lower(Stri) = "false" Return 0 Else Return Int(Stri) EndIf End Function Function GetINIFloat$(file$, section$, parameter$) Return Float(GetINIString(file$, section$, parameter$)) End Function this is the one after it. |
| ||
You'd need to see where getinistring$() gets called, and what filename gets passed to it. Then make sure that file actually exists. |
| ||
If must have returned '0' from f= readfile(file). This means the file cannot be read because most likely it does not exist, or does not have the path you expect it to. debuglog the value of 'file' before running the f = readfile(file) command and check that the file exists and that the path exists. If it does not your problem lies further up in the code wherever the value for file is specified. |