Click here to Skip to main content
16,020,381 members
Home / Discussions / C#
   

C#

 
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 
Thanks for your help !
No, it doesn't write the same file several times.
The only code dealing with files is posted above and here's what it does :

At first :
Open file 1 for reading
Read data from file 1
Close file 1
If file 2 exists :
Open file 2 for reading
Read data from file 2
Close file 2

File 1 name is stored between these, so the user can save clicking on a button.

Open file 1 for writing
Write data to file 1
Close file 1
If some data is for file 2 :
Open file 2 for writing <-- that's where it crashes
Write data to file 2
Close file 2

And if I try to delete file 2 before opening it for writing, there's no error after, and the file is actually deleted.

I know it's strange thing, I can't figure why it doesn't work Poke tongue | ;-P !
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 
AnswerRe: Problems with disposing rescources Pin
I Believe In GOD15-Oct-09 7:46
I Believe In GOD15-Oct-09 7:46 
GeneralRe: Problems with disposing rescources Pin
Kaare Tragethon15-Oct-09 7:49
Kaare Tragethon15-Oct-09 7:49 
AnswerRe: Problems with disposing rescources Pin
Luc Pattyn15-Oct-09 8:12
sitebuilderLuc Pattyn15-Oct-09 8:12 
GeneralRe: Problems with disposing rescources Pin
Kaare Tragethon15-Oct-09 8:34
Kaare Tragethon15-Oct-09 8:34 
QuestionVariable Get Set Pin
I Believe In GOD15-Oct-09 6:31
I Believe In GOD15-Oct-09 6:31 
AnswerRe: Variable Get Set Pin
EliottA15-Oct-09 6:41
EliottA15-Oct-09 6:41 
GeneralRe: Variable Get Set Pin
I Believe In GOD15-Oct-09 7:42
I Believe In GOD15-Oct-09 7:42 
AnswerRe: Variable Get Set Pin
Henry Minute15-Oct-09 6:55
Henry Minute15-Oct-09 6:55 

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.