System.IO.IOException: file used by another process

前端 未结 10 2357
囚心锁ツ
囚心锁ツ 2020-12-14 16:59

I\'ve been working on this small piece of code that seems trivial but still, i cannot really see where is the problem. My functions do a pretty simple thing. Opens a file, c

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 17:43

    After creating a file you must force the stream to release the resources:

    //FSm is stream for creating file on a path//
    System.IO.FileStream FS = new System.IO.FileStream(path + fname,
                                                       System.IO.FileMode.Create);
    pro.CopyTo(FS);
    FS.Dispose();
    

提交回复
热议问题