File I/O
Blitz3D Forums/Blitz3D Beginners Area/File I/O
| ||
I was trying out some file I/O (such as OpenFile, WriteString, etc) but the compiler doesn't seem to understand me. Even the code examples from BlitzPlus (which I have) do not compile, I get the following error: Not enough parameters. Am I doing somthing wrong? thanks. |
| ||
Can you post the offending code? It would help... |
| ||
Like I said, the code examples from the program don't work, but I guess I'll post them:; Changing part of a file using OpenFile, SeekFile and WriteInt ; Open/create a file to Write fileout = WriteFile("mydata.dat") ; Write the information to the file WriteInt( fileout, 1 ) WriteInt( fileout, 2 ) WriteInt( fileout, 3 ) WriteInt( fileout, 4 ) WriteInt( fileout, 5 ) ; Close the file CloseFile( fileout ) DisplayFile( "The file as originally written", "mydata.dat" ) ; Open the file and change the Third Integer file = OpenFile("mydata.dat") SeekFile( file, 8 ) ; Move to the third integer in the file WriteInt( file, 9999 ) ; Replace the original value with 9999 CloseFile( file ) DisplayFile( "The file after being midified", "mydata.dat" ) WaitKey() ; **** Function Definitions follow **** ; Read the file and print it Function DisplayFile( Tittle$, Filename$ ) Print tittle$ filein = ReadFile( Filename$ ) While Not Eof( filein ) Number = ReadInt( filein ) Print Number Wend CloseFile( filein ) End Function ----------------------------- ; Reading and writing a file using ReadString$ and WriteString functions ; Initialise some variables for the example String1$ = "A short string" String2$ = "A longer string since these are variables lengths" String3$ = "This is string3 " String4$ = "joined to string4" ; Open a file to write to fileout = WriteFile("mydata.dat") ; Write the information to the file WriteString( fileout, String1 ) WriteString( fileout, String2 ) WriteString( fileout, String3 + String4) WriteString( fileout, "Just to show you don't have to use variables" ) ; Close the file CloseFile( fileout ) ; Open the file to Read filein = ReadFile("mydata.dat") Read1$ = ReadString$( filein ) Read2$ = ReadString$( filein ) Read3$ = ReadString$( filein ) Read4$ = ReadString$( filein ) ; Close the file once reading is finished CloseFile( filein ) Print "String Variables Read From File - mydata.dat " Print Read1 Print Read2 Print Read3 Print Read4 WaitKey() ------------------------------- Both of these give 'Not Enough Parameters' error during compile time. What exactly does this error mean? Then I could try to figure out what is wrong |
| ||
You must either have a bad install of BlitzPlus, you have user libs installed that are conflicting with the base functions, or you have functions called the same thing in your code that are overriding the Blitz versions. Those are the only things I can think of... |
| ||
It's the Print command which doesn't have enough parameters. In Blitz3D you can use Print with no parameters, but BlitzPlus insists that you have one. So use Print "" to print a blank line. DebugLog is the same way. |
| ||
Thanks that solved it...why does blitz plus come with a help file that doesn't work on blitz plus? /boggle. Also there are some code examples missing double quote marks and such... /boggle |