Click here to Skip to main content
15,886,258 members
Home / Discussions / C#
   

C#

 
GeneralRe: a table of arraylist Pin
Luc Pattyn15-Oct-09 8:16
sitebuilderLuc Pattyn15-Oct-09 8:16 
GeneralRe: a table of arraylist Pin
abbd15-Oct-09 8:20
abbd15-Oct-09 8:20 
GeneralRe: a table of arraylist Pin
Saksida Bojan15-Oct-09 8:23
Saksida Bojan15-Oct-09 8:23 
GeneralRe: a table of arraylist Pin
Luc Pattyn15-Oct-09 8:45
sitebuilderLuc Pattyn15-Oct-09 8:45 
GeneralRe: a table of arraylist Pin
Luc Pattyn15-Oct-09 8:47
sitebuilderLuc Pattyn15-Oct-09 8:47 
GeneralRe: a table of arraylist Pin
OriginalGriff15-Oct-09 8:42
mveOriginalGriff15-Oct-09 8:42 
AnswerRe: a table of arraylist [modified] Pin
Saksida Bojan15-Oct-09 8:21
Saksida Bojan15-Oct-09 8:21 
QuestionAccess denied on opening a file for writing Pin
Member 405249815-Oct-09 7:45
Member 405249815-Oct-09 7:45 
Hello,

I'm writing a C#/.net3.5 application with VS2008 Pro, and I just found today that there is a problem opening a file for writing when the file already exists. I tried to reverse to old revisions with SVN, but the problem is still there.

The user can choose to open a file named, for example 'file.ext'. The file is read through a StreamReader and ReadToEnd() method. Once it's done, I call the Close() method on the StreamReader. I check if a second file, name 'file.rak' (that holds more information) exists, and if so, it's open with the same method as the first file. The name of the first file is stored in a class in the application. Both files have same structure.

Saving the file is made with a StreamWriter. I first open the file, then write my data with the Write() method, and I close it, with Close(). After the first file is written, I call the same method to write the second file. The problem is when I try to open the second file for writing (still with StreamWriter), I got an exception saying access to the file is denied.

I tried to see with Process Monitor the operations on the file, but we can see it's well closed after reading is done.

Any clue ?
Thanks ! Smile | :)

Fred
AnswerRe: Access denied on opening a file for writing Pin
OriginalGriff15-Oct-09 7:59
mveOriginalGriff15-Oct-09 7:59 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 8:51
Member 405249815-Oct-09 8:51 
AnswerRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 8:01
sitebuilderLuc Pattyn15-Oct-09 8:01 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:00
Member 405249815-Oct-09 9:00 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 9:21
sitebuilderLuc Pattyn15-Oct-09 9:21 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:58
Member 405249815-Oct-09 9:58 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 10:07
sitebuilderLuc Pattyn15-Oct-09 10:07 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 10:16
Member 405249815-Oct-09 10:16 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 10:25
sitebuilderLuc Pattyn15-Oct-09 10:25 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 10:34
Member 405249815-Oct-09 10:34 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 10:50
sitebuilderLuc Pattyn15-Oct-09 10:50 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 11:13
Member 405249815-Oct-09 11:13 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 11:57
sitebuilderLuc Pattyn15-Oct-09 11:57 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 21:40
Member 405249815-Oct-09 21:40 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:21
Member 405249815-Oct-09 9:21 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 9:26
sitebuilderLuc Pattyn15-Oct-09 9:26 
QuestionProblems with disposing rescources Pin
Kaare Tragethon15-Oct-09 7:37
Kaare Tragethon15-Oct-09 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.