Is it possible to write to a CD with .NET?

365 views Asked by At

I have a data file in f:\ drive named 'cd.txt'. I want to write this file to a CD i.e E:\.

String source ="F:\\cd.txt";
String destination="E:\\cd.txt";

File.copy(sorce,destination);

The above line is throwing exception saying:

"Access to the path 'E:\cd.txt' is denied"

4

There are 4 answers

0
RageZ On

I don't think that's so easily feasible, Windows explorer give the impression doing a file copy is enough but that not the case.

I think you might take a look at XPBurn component.

0
zfedoran On

You cant just copy files to a disc drive. Writing files to a CD-R is a complicated process.

I have heard of a C# .NET component called XPBurn. I have not used it, but it looks like it'll do what you need using the IMAPI Interfaces.

2
John Weldon On

Yes, but it's technically Windows API:

Dhawan the One

0
Dabiddo On

IMAPI is only for C++, is there a good wrapper for C#? o maybe a library? i used the project wrapper from the codeproject page.. i haven't test it, all i did was exclude the Interop folder and moved it to another project to try and build the winform in WPF.. therefore i excluded the Interop to a single class project for a DLL... will test it this week..