Oppure

Loading
07/10/20 7:31
fosforo
Ciao
Per studio, sto cercando di creare un programma per copiare file.
Ho problemi di permessi usando la classe FileStream.
Se lancio il Debug mi da questo errore:

System.UnauthorizedAccessException: 'Access to the path 'E:\' is denied.'

Aggiungo lo script:

fsIn = new FileStream(source, FileMode.Open);
fsOut = new FileStream(dest, FileMode.Create);

byte[] bt = new byte[1048756]; //1MB
int readByte;
while ((readByte = fsIn.Read(bt, 0, bt.Length)) > 0)
{
fsOut.Write(bt, 0, readByte);
worker.ReportProgress((int)(fsIn.Position * 100 / fsIn.Length));

}
fsIn.Close();
fsOut.Close();



Grazie anticipatamente
aaa
07/10/20 7:38
fosforo
Ciao

Ho risolto.
Devo aggiungere il nomefile nel path di destinazione.
aaa