HELP ! Comment changer la 6ème ligne d'un fichier INI ????????
cs_TSP
Messages postés3Date d'inscriptionsamedi 8 mars 2003StatutMembreDernière intervention 6 août 2003
-
4 août 2003 à 10:49
cs_TSP
Messages postés3Date d'inscriptionsamedi 8 mars 2003StatutMembreDerniè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 :
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 @+
cs_rene38
Messages postés1858Date d'inscriptionsamedi 29 juin 2002StatutMembreDernière intervention17 octobre 201311 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