473,327 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

File reading problem from DVD writer

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

Aug 21 '07 #1
2 2417
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.
"Mohammad Omer Nasir" <mo******@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
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

Aug 22 '07 #2
Thanks, pedrito!

Regards,
aimslife

Aug 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: reddy | last post by:
I am trying to insert a node into an XMLFile. using XMLTextwriter. My Question is Is it possible to do without using XMLDocument. Because its loading all the the file into memory. I just want to...
2
by: sp | last post by:
Hello everybody, I have an xml doc and I am trying to write the values from xml file to a tab delimited text file. Currently, what I am doing is I am reading xml file through XpathNavigaotr and...
9
by: Xarky | last post by:
Hi, I am writing an XML file in the following way. Now I need to read again that file to retrieve data such as Name and Age. Can someone help me out. Thanks in Advance ...
1
by: lkr | last post by:
hi i got one file transfer program using serialization which has a limitation that i can send only 8192 bytes(8KB). i want to send more than that wht can i do. how can i divide the file into...
5
by: ad | last post by:
I want to delete some text which begin with <!DOCTYPE and end with > in a file. How can I do it?
13
by: mloichate | last post by:
I must read a very heavy-weight text plain file (usually .txt extension) )and replace a given character with another given character in all text inside the file. My application was working pretty...
2
by: S.Creek | last post by:
Hi, I need to take few files (images in my case) and create one file out of them, this file should be accessed so i can grab a single image from it if necessary, i thought of taking all the...
4
by: Brian Parker | last post by:
Here's a snippet of code I have: ============================================== DataSet ds = new DataSet(); string strXMLFileName = Path.GetTempFileName(); StreamWriter sw = File.AppendText(...
10
by: JJ | last post by:
How can I get a SiteMapNodeCollection to output as an XML file?
6
Atran
by: Atran | last post by:
Hello: In this article: You will learn to Write or Read A Text File. Let's Begin: First Create a new project (ConsoleApp or WinApp). And Make sure your program uses these namespaces: using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.