Reputation: 2063
I've been trying to open a .html file and print some information in it, however there is a compilation error, that I can't find a solution online. Perhaps I can find some pointers here at SO.
The code looks like:
def PrintOut(db: Database, which:string)
var fi = FileStream.open("recipeprint.html", "w+")
stmt:Statement = PreparedStatements.select_recipe( db, which )
cols:int = stmt.column_count ()
var row = new dict of string, string
item:int = 1
while stmt.step() == ROW
for i:int = 0 to (cols - 1)
row[ stmt.column_name( i ) ] = stmt.column_text( i )
FileStream.puts( "<H1>%s</H1>", row[ "name" ])
FileStream.puts( "<H2>Source: %s</H2>", row[ "source" ])
FileStream.puts( "<H2>Servings: %s</H2>", row[ "servings" ])
FileStream.puts( "<H3>Ingredient List: </H3>" )
item++
I am compiling it with:
valac "%f" --pkg sdl --pkg sqlite3 --pkg gee-0.8
However, I keep getting the error:
valac "cookbook.gs" --pkg sdl --pkg sqlite3 --pkg gee-0.8 (no diretório: /home/luis/Dropbox/Documentos/Coding/Genie Programming Language) cookbook.gs:37.9-37.54: error: Access to instance member `GLib.FileStream.puts' denied
FileStream.puts( "<H1>%s</H1>", row[ "name" ])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cookbook.gs:38.9-38.64: error: Access to instance member `GLib.FileStream.puts' denied
FileStream.puts( "<H2>Source: %s</H2>", row[ "source" ])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cookbook.gs:39.9-39.68: error: Access to instance member `GLib.FileStream.puts' denied
FileStream.puts( "<H2>Servings: %s</H2>", row[ "servings" ])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is it to do with the version of gee that I got installed in my system?
Upvotes: 1
Views: 177
Reputation: 2063
My syntax is wrong. Filestream is a class that is instantiated in the variable fi. So the problem there is that I should be writing:
var entry = "<li>"+row[ "ingredients" ]+"</li>"
fi.puts( entry )
Nothing to do with the version of Gee.
The source that helped me understand the issue: here
Upvotes: 1