Bonjour,
En fait, je veux insérer du texte à la suite des lignes écrites.Mais je n'ai pas réussi.Toujours il écrase les lignes déjà écrites. Je ne vois pas la solution.
Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
44
45
46
47
48
49
50
51
52
53
54
if ((changedSnortRules)&& (uiIDSView.comboBox_rulesSNORT->currentText()
			!= "local.rules"))  {
		QDir appDir = QDir(qApp->applicationDirPath());
#if defined(Q_OS_WIN)
		if (appDir.dirName().toLower() == "debug" || appDir.dirName().toLower() == "release")
		appDir.cdUp();
#elif defined(Q_OS_MAC)
		if (appDir.dirName() == "MacOS") {
			appDir.cdUp();
			appDir.cdUp();
			appDir.cdUp();
		}
#endif
		QFile tempSnortRulesFile(appDir.path()
				+ "/temp/snortrules/snortruleschanges.txt");
		if (!tempSnortRulesFile.open(QIODevice::WriteOnly))
			return;
		QTextStream outchanges(&tempSnortRulesFile);
 
		applied = false;
 
		QString fileSnortRules;
		fileSnortRules = uiIDSView.comboBox_rulesSNORT->currentText();
 
		QList<QWidget *> widgets = console->ui.centralwidget->findChildren<
				QWidget *> ("tableWidget_RulesIDS");
		for (int k = 0; k < widgets.size(); k++) {
			if (widgets.value(k)->isVisible() == true) {
				QTableWidget * tableSnortRules = qobject_cast<QTableWidget*> (
						widgets.value(k));
				for (int i = 0; i < tableSnortRules->rowCount(); i++) {
					QLineEdit * lineEditSID = qobject_cast<QLineEdit*> (
							tableSnortRules->cellWidget(i, 0));
					QString lineEditSIDstring = lineEditSID->text();
 
					QComboBox * comboBoxStatus = qobject_cast<QComboBox*> (
							tableSnortRules->cellWidget(i, 1));
					QString comboBoxStatusstring =
							comboBoxStatus->currentText();
 
					QComboBox * comboBoxAction = qobject_cast<QComboBox*> (
							tableSnortRules->cellWidget(i, 2));
					QString comboBoxActionstring =
							comboBoxAction->currentText();
 
					outchanges << fileSnortRules << " " << lineEditSIDstring
							<< " " << comboBoxStatusstring << " "
							<< comboBoxActionstring << endl;
				}
			}
		}
 
		changedSnortRules = false;
	}