Bonjour à tous,
J'ai besoin d'écrire dans un fichier txt situé sur un ordinateur distant, connecté au réseau local.
Le streamWriter s'ouvre bien mais lorsque j'écris, rien n'apparait dans le fichier physique.

J'ai donc fais le test suivant :

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
 
            string path = @"\\MachineDistante\C$\Documents and Settings\User\Share";
 
            try
            {
                StreamWriter sw = new StreamWriter(Path.Combine(path, "MonFichier.txt"));
                sw.WriteLine("Test");
                sw.Close();
                StreamReader sr = new StreamReader(Path.Combine(path, "MonFichier.txt"));
                string line = sr.ReadLine();
                sr.Close();
            }
            catch (Exception e)
            {
            }
Ici "line" contient bien le mot "Test", mais si je vais lire le fichier physique ... rien. J'ai loupé quelque chose ?