cd inserted event


 
Thread Tools Search this Thread
Top Forums Programming cd inserted event
# 1  
Old 01-12-2004
cd inserted event

Smilie i am programming in c and i need to start a procedure automatically when a cd is inserted. Anyone knows how can i do it?

thanx
# 2  
Old 01-12-2004
Sounds like you need to create an autorun.inf file that will run your executable, which is more of a windows question than a c programming question.

http://msdn.microsoft.com/library/en...oplay_cmds.asp

http://autorun.moonvalley.com/autoruninf.htm
# 3  
Old 01-16-2004
Error

no,i need to detect when a cd is inserted into the cd-rom device in order to make a c language program do certain things
i need to know if there is some kind of signal or interrupt received from a cd insert event or something similar...
# 4  
Old 01-16-2004
Hi,

related to oomberas answer, you can start a small binary via autorun which sends you a signal.

regards
malcom
# 5  
Old 01-16-2004
I believe you may need to keep polling the device manually.
# 6  
Old 01-17-2004
Have a look at this code. Most of what you will need
is here if you are using Linux, BSD, etc.

www.hadess.net/files/patches/cdrom-test.c

- Finnbarr
# 7  
Old 01-17-2004
fpmurphy, that link did not work for me.

massimo_rati, you cannot have a process magically spring into existence because a cd has been inserted. You can write a daemon that will notice a cd insertion. SunOS comes with a volume manager that notices cd insertions and mounts the cd. Other versions of unix might have something similiar. This would be a problem for you. Most likely, only one such program could be running.

How this works will depend on the cd driver. You need to find the docs for your cd driver and read them.

Ideally, you will simply use open(2) on the device file for the cd. And you will not use O_NONBLOCK nor O_NDELAY. Thus the open will block until the device is ready.

But anything is possible. You're at the mercy of the driver's author.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Date from filename inserted into records

Hi Folks, I have below files in one directory: Spiross-MBP:AIRTEMP spirospap$ ls -1 CPK2004001 CPK2004002 CPK2004003 etc... JFK2003001 JFK2003002 JFK2003003 etc... TEB1999001 TEB1999002 TEB1999003 etc... Month/year is in Filename and also in the file Header, first line. (18 Replies)
Discussion started by: spirospap
18 Replies

2. Solaris

Copying existing OS to new inserted drives

Hi, I was wondering if there is an easy / recommended way to do the following: Copy existing OS to 2 NEW drives inserted to server. Netra 440 / Solaris 8 1. install the 2 new physical drives, 2. reconfigure the four drives to a RAID 1 array, and 3. copy the existing 2 drives... (4 Replies)
Discussion started by: kmac22068
4 Replies

3. UNIX for Dummies Questions & Answers

Output number of rows inserted, updated...

Hi all, I am new to Unix. I have written pl/sql script to be run in Unix. I have used Merge statement and subsequently would like to know the number of rows updated or inserted. Any suggestions in this regard would be great Thanks in advance Kushal (0 Replies)
Discussion started by: kushal_cog
0 Replies

4. UNIX for Dummies Questions & Answers

help needed with getting last inserted row id

Hi, I am working on a script that inserts one row of data at the time to a table. Among the fields of that table is the “serial” which is the auto increment. I need to be able to retrieve last inserted row id to use it for another insert. To retrieve last row id right after I do successful... (2 Replies)
Discussion started by: arushunter
2 Replies
Login or Register to Ask a Question