image file from a floppy. how to program???

  • Thread starter helpless newbie
  • Start date
H

helpless newbie

Hello.
I'm a newbie in c programming.
I'd like to make a program for creating an image file from a floppy disk.
Is there anyone with agood point of start in doing this?

Thanks.
 
J

Joona I Palaste

helpless newbie said:
Hello.
I'm a newbie in c programming.
I'd like to make a program for creating an image file from a floppy disk.
Is there anyone with agood point of start in doing this?

This can't be done in ISO standard C, which does not have the concept of
floppy disks. Please ask in a newsgroup dedicated to your own operating
system.
 
D

Dan Pop

In said:
I'm a newbie in c programming.
I'd like to make a program for creating an image file from a floppy disk.
Is there anyone with agood point of start in doing this?

Figure out if your operating system provides a way for accessing the
floppy drive as a file (e.g. /dev/fd0 under Linux). Open the file
associated to the device (if any) with fopen(), in binary read mode, and
keep reading until you reach the end of the file. You may need
administrator privileges in order to be allowed to access the device file.

If this approach doesn't work (no way to access the floppy device as an
ordinary file), you have to ask in a newsgroup dedicated to programming
on your particular OS.

Dan
 
R

Rich Gibbs

helpless newbie said the following, on 07/06/04 10:18:
Hello.
I'm a newbie in c programming.
I'd like to make a program for creating an image file from a floppy disk.
Is there anyone with agood point of start in doing this?

Thanks.

This is not something that can be done in standard C. The language
standard was developed with the idea that it would be implemented on
multiple platforms, so it does not include platform- or device-specific
ideas like "floppy disk" (or "clearing the screen" or "hit any key", to
pick two perennial favorites).

You need to ask this question in a group specific to the platform you
will be using. (For example, 'comp.unix.programmer' for Unix.)
 
D

Dan Pop

In said:
This can't be done in ISO standard C, which does not have the concept of
floppy disks.

It can be done in standard C, despite the lack of the concept of floppy
disks, as long as the implementation allows accessing the floppy disk
as an ordinary file. Simply ask the user to provide the "magic" file
name and the name of the image file and write code that copies data
from one file to another. Quite doable in standard C, methinks. Whether
the approach actually works on the OP's platform is a different story...

Dan
 
T

Thomas Matthews

helpless said:
Hello.
I'm a newbie in c programming.
I'd like to make a program for creating an image file from a floppy disk.
Is there anyone with agood point of start in doing this?

Thanks.

In some literary circles, an image file of a floppy disk
is the entire contents of the floppy stored as a file
on another device. This is a mechanism often used when
duplicating floppies.

Yes, this can be done using the C language and a lot of
platform specific functions. For example, you will need
to access the floppy as sectors of data and write that
data into a floppy. Writing out is easy and can be
done using standard C. However, accessing the sectors
of a floppy requires platform specific functionality
which is best discussed in a newsgroup about your
platform.

I don't suggest you do this as a newbie. You will need
to read up on your operating system's functions, determine
the type of floppy and how to access it. A lot of work
as a newbie function. I'd rather purchase a product
to duplicate floppies than write my own. I have better
things to do with my time.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
K

Kenneth Brody

helpless said:
Hello.
I'm a newbie in c programming.
I'd like to make a program for creating an image file from a floppy disk.
Is there anyone with agood point of start in doing this?

It depends on your O/S.

Under *nix, you could probably do something like:

FILE *floppy = fopen("/dev/fd0","r");

(Replacing "/dev/fd0" as needed for your particular platform.)

For other O/S's, you might be able to do the same thing, if you are able
to determine the proper name to pass to fopen().
 

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

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,369
Latest member
FTMZ

Latest Threads

Top