For Programmers: Free Programming Magazines  


Home > Archive > Fortran > December 2005 > Writing to a CD or a DVD









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Writing to a CD or a DVD
Wayne

2005-12-06, 7:06 pm

What's the procedure for reading or writing to a CD or a DVD?
I.e., how do you open the device?
I am currently using Lahey Fortran 95 Pro, version 5.6.

Thanks for any help.

Wayne

Rich Townsend

2005-12-06, 7:06 pm

Wayne wrote:
> What's the procedure for reading or writing to a CD or a DVD?
> I.e., how do you open the device?
> I am currently using Lahey Fortran 95 Pro, version 5.6.
>
> Thanks for any help.
>
> Wayne
>


I suspect the procedure to use has very little to do with your Fortran compiler
-- and more to do with the OS you are using. If you enlighten us as to the
latter, then someone might know.

cheers,

Rich
Wayne

2005-12-06, 9:59 pm


Rich Townsend wrote:
> Wayne wrote:
>
> I suspect the procedure to use has very little to do with your Fortran compiler
> -- and more to do with the OS you are using. If you enlighten us as to the
> latter, then someone might know.
>
> cheers,
>
> Rich


Wayne

2005-12-06, 9:59 pm

Rich:

I use Windows XP Pro.

I believe the solution is similar to writing to the printer:

program print
open(1,'prn')
write(1,'(a5)') 'print'
end

This works in Lahey/Fujitsu Fortran 95.
The CD or DVD will have to be indentified in the open specification.
But how?

Thanks for the reply.

Wayne

Joe Krahn

2005-12-06, 9:59 pm

Wayne wrote:
> Rich:
>
> I use Windows XP Pro.
>
> I believe the solution is similar to writing to the printer:
>
> program print
> open(1,'prn')
> write(1,'(a5)') 'print'
> end
>
> This works in Lahey/Fujitsu Fortran 95.
> The CD or DVD will have to be indentified in the open specification.
> But how?
>
> Thanks for the reply.
>
> Wayne
>

Writing to an optical disk usually is much more complex than writing to
a file. There are several special IO-control messages to get set up for
writing -- unless you have a packet-formatted disc, in which case it
looks like a regular hard-disk/floppy. However, some drives will accept
raw data and write it to the disc, such as DVD+R drives.

So, are you trying to write to a file on a packet-formatted CD/DVD, or
are you trying to write a filesystem image? Or, do you just want to
write raw data, as with tape drive I/O?

Joe Krahn
Mr Hrundi V Bakshi

2005-12-07, 4:01 am


"Joe Krahn" <jkrahn@nc.rr.com> wrote in message
news:Rwslf.5592$ev6.678734@twister.southeast.rr.com...

> Writing to an optical disk usually is much more complex than writing to
> a file.


And even after ca. 50 years fORTRAN hasn't got it right! but leaves to
standard C/C++.

>
> So, are you trying to write to a file on a packet-formatted CD/DVD, or
> are you trying to write a filesystem image? Or, do you just want to
> write raw data, as with tape drive I/O?


Why not drop the f'OR'uckTRAN chirade and admit that you're in over deep
and of little use to anyone. But it's clear that you're used to that.

Bye,
Hrundi V.B.


Gary L. Scott

2005-12-07, 7:04 pm

Joe Krahn wrote:
> Wayne wrote:
>
> Writing to an optical disk usually is much more complex than writing to
> a file. There are several special IO-control messages to get set up for
> writing -- unless you have a packet-formatted disc, in which case it
> looks like a regular hard-disk/floppy. However, some drives will accept
> raw data and write it to the disc, such as DVD+R drives.


But for most routine read/writes, the device driver should isolate you
from that. It should provide you with "typical" defaults.

>
> So, are you trying to write to a file on a packet-formatted CD/DVD, or
> are you trying to write a filesystem image? Or, do you just want to
> write raw data, as with tape drive I/O?
>
> Joe Krahn



--

Gary Scott
mailto:garyscott@ev1.net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

Why are there two? God only knows.


If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford
Brooks Moses

2005-12-08, 7:15 pm

Wayne wrote:
> I use Windows XP Pro.
>
> I believe the solution is similar to writing to the printer:
>
> program print
> open(1,'prn')
> write(1,'(a5)') 'print'
> end
>
> This works in Lahey/Fujitsu Fortran 95.
> The CD or DVD will have to be indentified in the open specification.
> But how?


Why do you believe that the solution is similar?

The 'prn' in that open statement is a system device that Windows XP
provides an interface to as if it is a file. Thus, any programming
language can open it using the normal file semantics.

Windows XP does not provide a system device of this type for the CD
drive; thus, I can't see why there would be a similar solution.

You can either find out what the Windows API functions are for accessing
the CD drive and then link your executable to the appropriate system DLL
(which will be fairly complicated, I suspect), or you can use one of the
various CD-drive driver programs that allow you to treat the drive as
any other filesystem and then open a file on it using your Fortran program.

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
feenberg@gmail.com

2005-12-09, 8:14 am

Wayne wrote:
> What's the procedure for reading or writing to a CD or a DVD?
> I.e., how do you open the device?
> I am currently using Lahey Fortran 95 Pro, version 5.6.
>
> Thanks for any help.
>
> Wayne


Are we sure there is a difficulty? If you put a blank cd in my XP
machine's cr-rw drive, a new drive letter shows up in "my computer",
and one can write to file on that drive as though they were disk files.
In fact, those files are kept on a virtual disk, and the actual write
won't occur untill you right click on the drive icon and select "write
to drive", at which time the CD is burned. Before XP I don't beleive
MS had any cd-rw facility at all.

If you wish to bypass that step, and write directly to the cd, I think
that is not supported and unlikely to be feasible.

Daniel Feenberg
feenberg is at nber dotte org

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com