File reading problem from DVD writer

  • Thread starter Mohammad Omer Nasir
  • Start date
M

Mohammad Omer Nasir

Hi,

I tried to write a utility for copy video file from DVD-RW Rom. When I
tried to access file from DVD-RW ROM, it trows exception "Access to
the path 'J:\VIDEO_TS\VIDEO_TS.BUP' is denied.". I tried below code
for file copy utility.

private void butCopyFile_Click(object sender, EventArgs e)
{
try
{
FileStream readFile = new FileStream(this.txtSourcePath.Text,
FileMode.Open);
FileStream writeFile = new
FileStream(this.txtDestinyPath.Text, FileMode.OpenOrCreate);
int rByte = 0;

while (rByte != -1)
{
rByte = readFile.ReadByte();
if (rByte != -1)
{
writeFile.WriteByte((byte)rByte);
}
else
{
MessageBox.Show("EOF");
}
}
writeFile.Close();
readFile.Close();
MessageBox.Show("Successful Complete!!!");
}
catch (UnauthorizedAccessException exp)
{
MessageBox.Show(exp.Message);
}
}
}

Please guide me, what I missed in code? and how I can access file from
DVD-RW?

Regards,
-aimslife
 
P

pedrito

If you don't specify the FileAccess parameter, it's going to default to
either Write or ReadWrite, depending on your FileMode. in the case of open,
ReadWrite. Since you can't write to the DVD-RW (at least not with these file
commands), it's going to throw an exception because the DVD-RW is considered
read-only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top