Re[4]: argv revisited



Le 5 mai 2016, Andrew Robinson a écrit :
I've just tested a filename containing spaces and U+221E (infinity
symbol), writing and reading both work.
So you verified that in Windows using the Win32 version of GTK+? Show me your
source code.

"Please."

Cross-compiled on Linux with i686-pc-mingw32-gcc from mingw-cross-env-2.21 (previous name of MXE), GTK2 statically linked. I think I already posted the code snippet for reading. Here for writing:
-:-:-:-
  GtkWidget *dialog;
  dialog = gtk_file_chooser_dialog_new
    ("Title", GTK_WINDOW(gtkwin),
     GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
  gtk_file_chooser_set_do_overwrite_confirmation
    (GTK_FILE_CHOOSER (dialog), TRUE);
  /* gtk_file_chooser_set_current_folder
         (GTK_FILE_CHOOSER (dialog), default_folder_for_saving); */
  gtk_file_chooser_set_current_name
    (GTK_FILE_CHOOSER (dialog), "foo.bar");
  if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT){
    char *filename;
    filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
    GFile *outfile=g_file_new_for_path(filename);
    GFileOutputStream *FOstream=
      g_file_replace(outfile, NULL, FALSE, G_FILE_CREATE_NONE, NULL,NULL);
    assert(FOstream);
    GDataOutputStream *DOstream=
      g_data_output_stream_new(G_OUTPUT_STREAM(FOstream));
    assert(DOstream);
    gboolean res=
      g_data_output_stream_put_string(DOstream,some_string,NULL,NULL);
    assert(res);
    g_object_unref(DOstream);
    g_object_unref(FOstream);
    g_object_unref(outfile);
    g_free(filename);
  }
  gtk_widget_destroy(dialog);
-:-:-:-



--
Lucas Levrel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]