Hello guys!!

I have no problems in compile time. But, when i try to write or read a file using Glib.FileStream.open() and puts() method in vala/genie I get an error. I get the same error running in msys2 console or in Windows system directly. The programs create the file but canot read or write into.

Any suggestions?
Thanks to all.

[indent=4]
// usa la libreria gtk
uses
   Gtk
// comienza la parte principal del programa
init
   Gtk.init (ref args)               // inicializa gtk
   var prueba = new ventana ()      // crea el objeto prueba
   prueba.show_all ()                  // muestra todo
   Gtk.main ();                      // comienza con el loop

class ventana : Window             // Crea una clase de ventana
   init
       title = "Ventana de prueba"          // escribe el titulo
       default_height = 250                // anchura
       default_width = 250                  // altura
       window_position = WindowPosition.CENTER  // posición

       // creamos un boton con la siguiente etiqueta
       var button = new Button.with_label ("Pulsa este botón")
       // Une el evento de clic de raton con la funcion pulsado
       button.clicked.connect (pulsado)

       // si pulsamos la x de la barra saldrá del loop
       destroy.connect(Gtk.main_quit)

       // añade el boton a la ventana
       add(button)

   def pulsado (btn : Button)
       // si se pulsa realiza algunos cambios.
       title = "Hola, Mundo"
var f = FileStream.open(GLib.Environment.get_home_dir()+"/archivon.txt","a")
       if f!=null
           f.puts("kksdfasdfasdfa")
           if (f.error () != 0)
               stdout.printf ("Error!\n")
               var n= f.error()
               print n.to_string()
           btn.label = "Escrito"


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Msys2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to