J'ai une exception que je ne comprends pas quand j'essaie d'ouvrir un fichier en écriture:
Unhandled Exception: System.UnauthorizedAccessException: Access to the path '/home/manuel/Desktop/ps/2004-2005/poo/examen-part1/ CompteurTest/compteurs' is denied.
in <0x0023e> System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool)
in <0x00057> System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
in <0x00073> (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
in <0x00065> CompteurSerial:Ecrire (CCompteur)
in <0x0014c> CCompteur:GetNextval ()
in <0x00056> MainClass:Main (string[])
Or j'ai bien le droit d'écrire dans le répertoire et dans le fichier.
L'instruction qui coince:
FileStream f = new FileStream(dir+compteur.name, FileMode.OpenOrCreate, FileAccess.ReadWrite);
Forum Programmation.c# Pb d'accès à un fichier en écriture
25
jan.
2005