1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
void MyFrame::OnOuvrir(wxCommandEvent& WXUNUSED(event))
{
int x,y;
wxFileDialog dialog (this, _T("Choisir un fichier"),_T("C:\\"), _T(""),
_T("Fichiers Losange|*.los|"
"All files|*.*"), wxOPEN);
if (dialog.ShowModal()== wxID_OK)
{
std::ifstream fo(dialog.GetPath().c_str(), std::ios::in);
if (!fo)
{
char errormsg[110];
strcpy(errormsg,"Unable to open file ");
strcat(errormsg,dialog.GetPath().c_str());
wxMessageDialog msg(this, errormsg, "Erreur", wxOK | wxCENTRE | wxICON_ERROR);
msg.ShowModal();
return ;
}
else {
num_los=0;
//Recuper les donnees
fo >> num_los;
fo >> x >> y;
//Fermmer lefichier
fo.close();
if (tab_los!=NULL) {menuOption->Enable(App_Triangle,true);}
}
}
} |
Partager