- Home /
 
 
               Question by 
               twoface262 · Apr 11, 2012 at 10:46 PM · 
                file-iostreamreader  
              
 
              Streamwriter Access violation
Hello, I'm getting a weird error with my streamwriter code.
Here is where the code is giving me the error
 var save : StreamWriter = new StreamWriter("Saves/Controls/controls.txt",true);
 
               Here is the code.
    function WriteFile(path : String)
 
 {
    
     var save : StreamWriter = new StreamWriter("Saves/Controls/controls.txt");
     save.Flush();
     save.Close();
 
 }
 
               Thanks!
Here is the error
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) System.IO.File.OpenRead (System.String path) System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) System.IO.StreamReader..ctor (System.String path)IOException: Sharing violation on path C:\Users\me\Documents\game\Saves\Controls\controls.txt
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Android File-io? 1 Answer
Saving and Reading values 0 Answers
Loading from multiple files? 2 Answers
Does StreamReader work when porting to OSX? 1 Answer
Cloud recognition in Vuforia 0 Answers