HELP ! Comment changer la 6ème ligne d'un fichier INI ????????

cs_TSP Messages postés 3 Date d'inscription samedi 8 mars 2003 Statut Membre Dernière intervention 6 août 2003 - 4 août 2003 à 10:49
cs_TSP Messages postés 3 Date d'inscription samedi 8 mars 2003 Statut Membre Dernière intervention 6 août 2003 - 6 août 2003 à 12:59
Salut !
En fait, j'ai un fichier INI contenant des commentaires sur les 5 premières lignes puis un chiffre sur la 6ème.
C'est ce chiffre qu'il faudrait que je change.
Il faudrait un programme permettant de passer d'un contenu :

"********"
"**"
"**************"
"***"
"*"
nombre1

à :

"********"
"**"
"**************"
"***"
"*"
nombre2

Merci

TSP

PS : J'avais essayé avec

Set Fsys = CreateObject("Scripting.FileSystemObject")
Set monfic = Fsys.CreateTextFile("c:\windows\bureau\fichier.ini")
With monfic
.writeLine
.writeLine
.writeLine
.writeLine
.writeLine
.writeLine nombre2
End With

mais le problème c'est que ça effaçait les 5 premières lignes

si qn pourrait aider un pauvre débutant :shy) , ça serait cool 8-) , allez @+

TSP :approve)
[mailto: the_spy_programmer@hotmail.com]

3 réponses

juvamine Messages postés 468 Date d'inscription vendredi 21 février 2003 Statut Membre Dernière intervention 30 août 2007 2
4 août 2003 à 11:14
salut
essai ca je te promet rien!

Open "c:\windows\bureau\fichier.ini" For Output As #1
For i = 1 To 6
If i = 6 Then Print #1, nombre2
Next i
Close #1

mais ca devrai passé
bonne prog
@+
juvamine ;-)
0
cs_rene38 Messages postés 1858 Date d'inscription samedi 29 juin 2002 Statut Membre Dernière intervention 17 octobre 2013 11
4 août 2003 à 12:06
Bonjour
SURTOUT PAS !!!
Si tu ouvres le fichier en Output, tu effaces son contenu

Dim i As Long, Ligne As String, SixiemeLigne As String
Dim FichIni As String, FichAna As String
SixiemeLigne = "nombre2"
FichIni = "c:\windows\bureau\fichier.ini"
FichAna = "c:\windows\bureau\fichier.ana"
Open FichIni For Input As #1
Open FichAna For Output As #2
For i = 1 To 5
Input #1, Ligne
Print #2, Ligne
Next i
Print #2, SixiemeLigne
Do While Not EOF(1)
Input #1, Ligne
Print #2, Ligne
Loop
Close
Kill FichIni
Name FichAna As FichIni
0
cs_TSP Messages postés 3 Date d'inscription samedi 8 mars 2003 Statut Membre Dernière intervention 6 août 2003
6 août 2003 à 12:59
Merci bcp, ça marche nickel ton truc rene38
Allez à + et encore merci à vous 2 d'avoir aider un débutant

:big) :big) TSP :big) :big)
[mailto: the_spy_programmer@hotmail.com]
0
Rejoignez-nous