DCoder Sauvgarder un fichier texte

Bonjour,
J'utilise l'application Android DCoder et j'aimerais tout simplement savoir comment enregistrer un fichier texte avec la fonction File.WriteAllLines().
Actuellement j'ai une erreur comme quoi le chemin specifié n'est pas bon. Voici le chemin spécifié "/storage/emulated/0/montexte.csv". Évidement montexte.csv n'existe pas encore mais normalement il est censée créer un fichier non ?
Merci pour vos réponses

1 réponse

  1. Bonjour
    Je ne connais pas cette application, mais au départ C# est un langage windows, alors peut-être faut-il des \ dans ton chemin.
    0
    1. Je vais regarder merci
      0
    2. Ha bah maintenant, j'ai plus les droits ???????? j'ai cette erreur :

      Unhandled Exception:
      System.UnauthorizedAccessException: Access to the path "/var/www/webapp/Dcoder/pass.csv" is denied.
      at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) <0x7fc86f672290 + 0x00532> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) <0x7fc86f672240 + 0x00017> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
      at System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) <0x7fc86f663460 + 0x00078> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) <0x7fc86f663220 + 0x00088> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at System.IO.StreamWriter..ctor (System.String path) <0x7fc86f663170 + 0x0002a> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string)
      at System.IO.File.WriteAllLines (System.String path, System.String[] contents) <0x7fc86f671770 + 0x0003c> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at Dcoder.Program.Main (System.String[] args) [0x000a8] in <537e4b5f6b2241eaa2871df140668f34>:0
      [ERROR] FATAL UNHANDLED EXCEPTION: System.UnauthorizedAccessException: Access to the path "/var/www/webapp/Dcoder/pass.csv" is denied.
      at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) <0x7fc86f672290 + 0x00532> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) <0x7fc86f672240 + 0x00017> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
      at System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) <0x7fc86f663460 + 0x00078> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) <0x7fc86f663220 + 0x00088> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at System.IO.StreamWriter..ctor (System.String path) <0x7fc86f663170 + 0x0002a> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string)
      at System.IO.File.WriteAllLines (System.String path, System.String[] contents) <0x7fc86f671770 + 0x0003c> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
      at Dcoder.Program.Main (System.String[] args) [0x000a8] in <537e4b5f6b2241eaa2871df140668f34>:0
      0
    3. C'est pas le même fichier
      0
    4. En fait si c'est parce que le fichier que j'essaye d'enregistrer s'appelle pass.csv.
      La, je fais juste File.WriteAllLines("pass.csv",monArray[])
      0

Discussions similaires

question pix mot caché

7 réponses