TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Stefan Cazacu
NA
28
27.4k
file copy issue in c#
Oct 4 2013 1:19 PM
I'm using "System.IO.File.Copy(recovery, set, true);" to copy recovery.txt over set.txt
The problem is, i think, the file is still in use when I attempt to further alter it. (the compiler throws an exception)
I've had a similar issue when using StreamWriter, however that was fixed by using writerObj.Close(). Is there anything similar for system.io?
This is probably an easy fix, however, i couldn't find a fix on msdn. Using google i must not be phrasing the question right as the only results include StreamWriter/StreamReader
EDIT:
I think i've managed to pinpoint the issue. After i copy the backup of set.txt i load the new values from the file and that seems to keep the file opened. The way i load values off the file is: use StreamReader to go through the file line by line and save numeric values in an array. Then i assign each member of the array to a functional parameter. My best guess is that somehow the functional parameters are still linked to the text file. Any suggestions?
Reply
Answers (
3
)
CheckBox List from Db using Dbfirst approach in MVC4
Load new assembly at runtime..?