begin process at 2008 08 20 14:18:31
1 228 884 membres
250 nouveaux aujourd'hui
14 258 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : probleme d'ouverture de fichiers [ Archives / GTK+ ] (patouane)

probleme d'ouverture de fichiers le 10/05/2006 01:03:23

patouane

Salut j'utilise GTK+ avec dev c++ et je cherche à ouvrir des fichiers situés dans "pEntry" le code passe à la compilition par contre l'exe bug. Peut etre un probleme entre gchar et char???????

merci d'avance

#include <stdlib.h>
#include <gtk/gtk.h>
#include <stdio.h>
#include <string.h>
#define largeur 10000

 

void OnUpdate(GtkWidget *pEntry, gpointer data);

int main(int argc,char **argv)
 {
   GtkWidget* pWindow;
   GtkWidget *pMainVBox;
   GtkWidget *pFrame;
   GtkWidget *pSpin;
   
   gdouble valeur;
  
   GtkWidget *pButton;
   GtkWidget *pEntry;
   GtkWidget *pLabel;

   
   gtk_init(&argc,&argv);

   pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title(GTK_WINDOW(pWindow), "GtkSpinButton");
   gtk_window_set_default_size(GTK_WINDOW(pWindow), 300, 550);
   gtk_container_set_border_width(GTK_CONTAINER(pWindow), 4);

   pMainVBox = gtk_vbox_new(TRUE, 0);
   gtk_container_add(GTK_CONTAINER(pWindow), pMainVBox);

  
   pFrame = gtk_frame_new("Nombre de fichier");
   pSpin = gtk_spin_button_new_with_range(0, 255, 1);
   gtk_container_add(GTK_CONTAINER(pFrame), pSpin);
   gtk_box_pack_start(GTK_BOX(pMainVBox), pFrame, FALSE, FALSE, 0);
  
   pFrame = gtk_frame_new("Nombre de lignes non numeriques");
   pSpin = gtk_spin_button_new_with_range(0, 255, 1);
   gtk_container_add(GTK_CONTAINER(pFrame), pSpin);
   gtk_box_pack_start(GTK_BOX(pMainVBox), pFrame, FALSE, FALSE, 0);
  
  
   pLabel = gtk_label_new("Entrez la racine de votre fichier( c:/......fuite.txt:");
   gtk_box_pack_start(GTK_BOX(pMainVBox), pLabel, TRUE, FALSE, 0);

  
  
    /* Creation du GtkEntry */
    pEntry = gtk_entry_new();
    /* Insertion du GtkEntry dans la GtkVBox */
    gtk_box_pack_start(GTK_BOX(pMainVBox),pEntry, TRUE, FALSE, 0);

  

  
    pButton = gtk_button_new_with_label("Valider");
    gtk_box_pack_start(GTK_BOX(pMainVBox),pButton, TRUE, FALSE, 0);


/* Connexion du signal "activate" du GtkEntry */
    g_signal_connect(G_OBJECT(pEntry), "activate", G_CALLBACK(OnUpdate), (gpointer)pEntry );
 
    /* Connexion du signal "clicked" du GtkButton */
    /* La donnee supplementaire est la GtkVBox pVBox */
    g_signal_connect(G_OBJECT(pButton), "clicked", G_CALLBACK(OnUpdate), (gpointer)pEntry);

 

 

 

 

   gtk_widget_show_all(pWindow);

  
   
   
   g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);

   gtk_main();

   return EXIT_SUCCESS;
}

 


void OnUpdate(GtkWidget *pEntry, gpointer data)

 FILE *f_result;
  char* tab="123";
   const gchar* sText;
  
    
 sText = gtk_entry_get_text(GTK_ENTRY(pEntry));
 
 
 f_result = fopen(sText,"r+");
  
 fputs(tab,f_result);
 
 fclose(f_result);
}





Patouane



Classé sous : box, gtk, pwindow, gtkwidget, pentry

Participer à cet échange

Pub



Appels d'offres

CalendriCode

Août 2008
LMMJVSD
    123
45678910
11121314151617
18192021222324
25262728293031

VS Express FR Gratuit !

VS Express en français et 100% gratuit !

Téléchargements

Logiciels à télécharger sur le même thème :

Boutique

Boutique de goodies CodeS-SourceS