klixy23
22nd October 2002, 11:52
Hi,
how is it possible to detect an empty or not empty disk in a floppy drive?
Thanks for hints!
OmeLuuk
24th October 2002, 21:25
Look into the drive?
mark_h
24th October 2002, 22:43
I will admit that I found your reply humorous, but for Klixy23 I must ask that you stay on topic. Lets not clutter the thread, so you can send me a PM.
Mark
shah_bs
25th October 2002, 04:28
This is not very elegant, but you could attempt to copy a very small dummy file from the unix file system to the A:\ by using server2client() function (which you can look up in the very excellant library link above). If it returns an error number less than 0, one possible reason is the floppy drive is empty. Unfortunately, that may not be the only reason (other reason being for example, the dummy file already exists on the floppy), but for most practical purposes, I have not known server2client() to fail on copy.
Hope this helps.
eppesuiG
25th October 2002, 11:00
Are you talking about the client or the server machine? Windows or Unix?
Bye,
Giuseppe Sacco
Han Brinkman
26th October 2002, 18:41
That function works fine. I had to create a file which will be send to a bank. Use the server2client function to write the file directly to the disk. The return code will let you know if it has succeeded or failed.
Rrgds,
Han
shah_bs
28th October 2002, 04:15
Are you talking about the client or the server machine? Windows or Unix?
Well, I made the assumption that this was a file transfer type of requirement, so the file that is created in on the server, but the final destination is the A:\ drive on the CLIENT machine. The operating system, I think, should be immaterial. My original answer was based on assumption that server is UNIX and the client is MS Windows.
klixy23
28th October 2002, 11:02
Thanks for replys, ideas and hints.
Here is my code. It works fine for us. Sorry for german messages. I inserted a translation as comment. ;)
long fp, ok, ret
ok = false
repeat
fp = seq.open.local(spool.fileout, "r", 0)
if fp >= 0 then
if ask.enum("tcgenyesno", tcyesno.no,
"Datei besteht bereits. Soll die Datei überschrieben werden?") = tcyesno.no then
| "File exists. Overwrite?"
ret = input.string("Messprotokoll speichern", "Neuer Dateiname", 25, 25, spool.fileout)
| "Save protocol", "New file name"
if not ret then
seq.close.local(fp)
choice.again()
endif
ok = false
else
ok = true
endif
else
repeat
fp = seq.open.local(spool.fileout, "w", 1)
if fp < 0 then
message("Eine formatierte Diskette in das Laufwerk A: einlegen!")
| "Insert a formatted disk in drive A:!"
endif
until fp >= 0
ok = true
endif
seq.close.local(fp)
until ok