int main(int argc, char *argv[]) { FICHIER *f1; FICHIER *f2; char c; if (argc != 3) exit(-1); f1 = ouvrir (argv[1], 'L'); if (f1 == NULL) exit (-1); f2 = ouvrir (argv[2], 'E'); if (f2 == NULL) exit (-1); while (lire (&c, 1, 1, f1) == 1) { ecrire (&c, 1, 1, f2); } fermer (f1); fermer (f2); return 0; }
FenetreScannerLED::FenetreScannerLED(QWidget *parent) : QDialog(parent), ui(new Ui::FenetreScannerLED) { ui->setupUi(this); GestionDMX *interfaceDMX; interfaceDMX = GestionDMX::getInstance(); this->configurerAdaptateur(); interfaceDMX->seConnecter(); interfaceDMX->resetDMX(); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(fermer())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(confirmationAppareil())); connect(ui->verticalSliderPAN, SIGNAL(valueChanged(int)), this, SLOT(miseAJourDMX())); connect(ui->verticalSliderTILT, SIGNAL(valueChanged(int)), this, SLOT(miseAJourDMX())); connect(ui->verticalSliderCOULEUR, SIGNAL(valueChanged(int)), this, SLOT(miseAJourDMX())); connect(ui->spinBoxPAN, SIGNAL(valueChanged(int)), this, SLOT(verifierCanal())); connect(ui->spinBoxTILT, SIGNAL(valueChanged(int)), this, SLOT(verifierCanal())); connect(ui->spinBoxCOULEUR, SIGNAL(valueChanged(int)), this, SLOT(verifierCanal())); connect(ui->spinBoxSuppl, SIGNAL(valueChanged(int)), this, SLOT(modifierNombreWidgetSuppl())); this->nbAjouts = 0; this->layoutSuppl = new QVBoxLayout; ui->scrollAreaWidgetContents->setLayout(this->layoutSuppl); this->verifierCanal(); }
int partie2 (char* fichier1, char* fichier2){ FICHIER *f1; FICHIER *f2; char c; f1 = ouvrir (fichier1, 'L'); if (f1 == NULL) exit (-1); f2 = ouvrir (fichier2, 'E'); if (f2 == NULL) exit (-1); while (lire (&c, 1, 1, f1) == 1) { ecrire (&c, 1, 1, f2); } fermer (f1); fermer (f2); return 0; }
int partie3 (char* fichier){ FICHIER *f1; f1 = ouvrir(fichier, 'E'); if(f1 == NULL) exit(-1); time_t date = time(NULL); fecriref(f1, "Ceci est une ligne sans parametre\n"); fecriref (f1, "Nous sommes le : %s",asctime(localtime(&date))); fecriref(f1,"Il s'est ecoule %d secondes depuis le 1er %s %d.\n", (int) time(NULL),"janvier",1970); fecriref (f1, "Un exemple avec un chiffre negatif : %d \n", -1257); fermer(f1); return 0; }
int main(int argc, char **argv) { FICHIER *f1;//*f2 : unused variable if(argc != 2) exit(-1); //On a du modifier cette ligne car argv[2] est faux. //ligne originale : f1 = ouvrir (argv[2], 'E'); //Sachant que argc == 2 prendre argv[2] ne sert pas à grand chose ..... f1 = ouvrir(argv[1], 'E'); if(f1 == NULL) exit(-1); fecriref (f1, " %c %s 12\n", 'a', "bonjour"); fecriref (f1, " %d \n", -1257); fermer(f1); return 0; }
DialogSouhait::DialogSouhait(Souhait *souhait, QWidget *parent) : QDialog(parent), ui(new Ui::DialogSouhait) { ui->setupUi(this); m_souhait = souhait; changed = false; this->setWindowTitle("Liste des souhaits"); // Création de la barre de menu m_menu.setupUi(ui->widget_barreMenu); m_menu.label_fenetre->setText("Souhait"); m_menu.image_fenetre->setPixmap(QPixmap(":/app/bien96")); m_menu.pushButton_1->setToolTip("Valider"); m_menu.pushButton_2->setToolTip("Annuler"); m_menu.pushButton_3->setVisible(false); ui->label_NomClient->setText((m_souhait->getClient())->getNom()); ui->lineEdit_BudgetMax->setText(QString::number(m_souhait->getBudget())); ui->lineEdit_SurfHabMin->setText(QString::number(m_souhait->getSurfaceHabitable())); ui->lineEdit_SurJardMin->setText(QString::number(m_souhait->getSurfaceJardin())); m_listeVilles = m_souhait->getVilles(); for (int i=0; i<m_listeVilles.size(); i++) { ui->textEdit_Villes->append(m_listeVilles[i]->getNom()+" ("+m_listeVilles[i]->getCodePostal()+")"); } // Signaux & slots QObject::connect(m_menu.pushButton_2,SIGNAL(clicked()),this,SLOT(fermer())); QObject::connect(m_menu.pushButton_1,SIGNAL(clicked()),this,SLOT(valider())); QObject::connect(ui->button_ChercherVilles,SIGNAL(clicked()),this,SLOT(chercherVilles())); QObject::connect(ui->lineEdit_BudgetMax,SIGNAL(textChanged(QString)), this, SLOT(setEtat(QString))); QObject::connect(ui->lineEdit_SurfHabMin,SIGNAL(textChanged(QString)), this, SLOT(setEtat(QString))); QObject::connect(ui->lineEdit_SurJardMin,SIGNAL(textChanged(QString)), this, SLOT(setEtat(QString))); QObject::connect(ui->comboBox_Ville,SIGNAL(activated(QString)), this, SLOT(copierVille(QString))); }
int main(int argc, char *argv[]) { FICHIER *f1; int nb_notes, i; if (argc != 3) exit(-1); nb_notes = atoi(argv[1]); srand(time(NULL)); f1 = ouvrir (argv[2], 'E'); if (f1 == NULL) exit (-1); for(i = 0; i < nb_notes; i++) { fecriref(f1, "note= %d, coef= %d\n", rand()%20+1, rand()%6+1); } fermer (f1); return 0; }
/******************************************************************** * * * Gestion du menu * * * ********************************************************************/ boolean MenuSelect(int object, int scan, int state, int button) { int index, entree, key; if (object < 0) { /* attend qu'on relache la souris */ NoClick(); if (button < 0) { /* regarde la touche */ key = scantoascii(scan); if (key == 0) key = scan & 0xFF00; /* scan code */ else key = UpperChar(key); for (index = 0; index < NbMenus; index++) for (entree = 0; entree < MenuShortCuts[index].nb_entrees; entree++) if (MenuShortCuts[index].menu[entree].key == key && MenuShortCuts[index].menu[entree].state == state) { if (ob_isstate(Menu, MenuShortCuts[index].menuid, DISABLED) == 0 && ob_isstate(Menu, MenuShortCuts[index].menu[entree].itemid, DISABLED) == 0) { object = MenuShortCuts[index].menu[entree].itemid; index = NbMenus; } break; } } } if (object < 0) return FALSE; /* kein entsprechender Eintrag gefunden */ /* Men�punkte 'Fenster wechseln' und 'Fenster schliežen' werden inklusive der dazugeh”rigen Hotkeys automatisch verwaltet */ switch (object) { /* menu Zorg */ case INFORMATIONS: presentation(); break; /* menu Etat */ case INFORMATION: informations(Drive); break; case REPERTOIRE_LOUPE: if (ManageVFAT) open_directory_vfat(); else open_directory_short(); break; case TEST_STRUCTURE: if (ManageVFAT) structure_test_vfat(Drive); else structure_test_short(Drive); break; case STATISTIQUES: statistiques(Drive); break; case OCCUPATION: occupation(Drive); break; case TRACE_UN_FICHIER: trace_file(); break; case QUITTER: if (Reset) { if (my_alert(1, 2, X_ICN_QUESTION, Messages(MENU_1), Messages(BOOT_32)) == 0) shutdown(TRUE); } else { button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_2), Messages(MENU_4)); if (button == 0 || button == 1 && (int)xbios(0x11) % 2) shutdown(FALSE); } break; /* menu Ouvre */ case UNITE_LOGIQUE: open_disk(); break; case OUVRE_DISQUETTE: raw_floppy(FALSE); break; case OUVRE_DISQUE_DUR: raw_hard(FALSE); break; case OUVRE_FICHIER: open_file(); break; case OUVRE_FICHIER_FS: open_file_other_fs(); break; case OUVRE_FICH_TEXTE: voir_fichier(); break; case CREER_FICHIER: creer_fichier(); break; case FERMER: fermer(Thefrontwin -> win -> handle); break; case LIRE_BOOT: lire_boot(); break; case CHARGER_BOOT: charger_boot(); break; case SAUVER_BOOT: sauver_boot(); break; case ECRIRE_BOOT: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else ecrire_boot(); #endif break; /* menu Edition */ case SAUVER_SECTEUR: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else save_secteur(Thefrontwin, MENU_EDITION); #endif break; case COPIER_SECTEUR: copier_tampon(Thefrontwin); break; case COLLER_SECTEUR: coller_tampon(Thefrontwin); break; case ECHANGER_TAMPON: echanger_tampon(Thefrontwin); break; case RETOUR_INITIAL: load_secteur(Thefrontwin, MENU_EDITION); break; case OUVRIR_TAMPON: ouvrir_tampon(); break; case SAUVER_TAMPON: sauver_tampon(); break; case CHARGER_TB_ASCII: ascii_tampon(); break; case EFFACER_TAMPON: effacer_tampon(); break; /* menu Structure */ case DEFRAGMENTATION: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else reconnect(Drive); #endif break; case UNIQUE_LIBRE: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else compresse(Drive); #endif break; case RESTO_COMPLETE: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else restauration_complete(Drive); #endif break; case VIDE_CLST_LIBRES: nettoie_clusters_libres(Drive); break; case NETTOIE_REPERTOI: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else nettoie_repertoire(Drive); #endif break; /* menu Deplacement */ case SECTEUR_SUIVANT: next_secteur(Thefrontwin); break; case SECTEUR_PRECEDEN: previous_secteur(Thefrontwin); break; case BLOC_SUIVANT: next_bloc(Thefrontwin); break; case BLOC_PRECEDENT: previous_bloc(Thefrontwin); break; case MARQUER_POSITION: marquer_position(Thefrontwin); break; case ALLER_MARQUE: goto_marque(Thefrontwin); break; case ALLER_SECTEUR: goto_secteur(Thefrontwin); break; case CHERCHER_CHAINE: search_first(Thefrontwin); break; case CHERCHER_NOUVEAU: search_next(Thefrontwin); break; /* menu Fenˆtres */ case CHOIX_FONTE: choix_fonte(Thefrontwin); break; case CHOIX_COULEURS: couleur(Thefrontwin); break; case TAILLE_IDEALE: taille_ideale(Thefrontwin); break; case ASCENSEURS: ascenseurs(Thefrontwin); break; case CYCLER_FENETRES: cycle_window(); break; case WINDOW_LIST_1: case WINDOW_LIST_2: case WINDOW_LIST_3: case WINDOW_LIST_4: case WINDOW_LIST_5: case WINDOW_LIST_6: case WINDOW_LIST_7: case WINDOW_LIST_8: case WINDOW_LIST_9: case WINDOW_LIST_10: { windowptr thewin; for (thewin = Firstwindow; thewin; thewin = thewin -> next) if (thewin -> menu_entry == object - WINDOW_LIST_1) make_frontwin(thewin); } break; /* menu Options */ case CONFIG_GENERALE: config_generale(); break; case CONFIG_DSK: config_disques(); break; case RACCOURCIS_CLAVI: raccourcis_clavier(); break; case DONNEES_ZORG: from_zorg_inf(TRUE); break; case DONNEES_SYSTEME: from_zorg_inf(FALSE); break; case INVALIDE_CACHE: if (Kbshift(FAIL) & 4) { int i; for (i=0; i<MAX_DEVICES; i++) change_disque(i, FALSE); } else change_disque(Drive, TRUE); break; case UPDATE_SYSTEME: if (Kbshift(FAIL) & 4) { int i; for (i=0; i<MAX_DEVICES; i++) update_systeme(i); } else update_systeme(Drive); break; case VISU_TEXTE: really_voir_fichier(Thefrontwin -> fonction.fichier.nom); break; case VISU_ASCII: secteur_ascii(Thefrontwin); break; case VISU_HEXA: secteur_hexa(Thefrontwin); break; case AFFICHE_DECIMAL: affichage_decimal(Thefrontwin); break; case FICHIER_ASSOCIE: secteur_file(Thefrontwin); break; case CURSEUR_VISIBLE: curseur_on(Thefrontwin); break; case CLIPBOARD_GEM: clipboard_gem(Thefrontwin); break; /* menu Aide */ case TABLE_ASCII: AsciiChar = m_ascii_box(AsciiChar, FALSE); break; case AIDE: aide(); break; case EXECUTER_PROG: lance_prg(); break; case RESET: if (Reset) { Reset = FALSE; menu_icheck(Menu, RESET, 0); } else { int button; button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_3), Messages(MENU_5)); if (button == 1) shutdown(TRUE); else if (button == 0) reset(); } break; } return TRUE; } /* MenuSelect */