URL: https://linuxfr.org/forums/programmation-c--3/posts/pb-dacc%C3%A8s-%C3%A0-un-fichier-en-%C3%A9criture Title: Pb d'accès à un fichier en écriture Authors: fog Date: 2005年01月25日T18:17:43+01:00 Tags: Score: 0 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);