Is writing to tape drives any different? (Plain C and Objective-C)
I understand that writing to tape (say floppy) drives using plain C (say the openf statement and subsequent standard C file-write functions) is fundamentally different than writing to regular hard drives. I understand that I have to be careful about what block sizes I use, etc. Can some C veteran confirm that I am right? If I'm right, some further info would be appreciated, such as how I determine the right block si开发者_Go百科ze at run-time, etc.
And for Objective-C programmers: Do the Foundation classes to write files abstract away such details in that I can just stop worrying about what kind of a physical media I'm writing to? I.e., do the, say, NSFileManager methods support tape drives without me having to worry about anything?
Note: I am writing a modern Mac app. However, even though tape drives are rare these days (right?), it seems imprudent to just assume them away. Agreed? If this is the case, and Foundation abstracts such details away (which I hope it does), I should much rather prefer Foundation over plain C, right?
openf
? What OS is this? I always just used open
, read
, write
, and close
for writing to tape for the most part. I think there's some ioctl
commands to do seeks, and they take a while, but that was it.
As for floppies, they have always just looked like small volumes without a partition map. vfat
was the usual Linux volume type, IIRC. Nothing special about accessing them.
P.S. I can honestly say that, unless you need a tape drive, you can assume them away at this point. I got rid of my last one years ago, and at work the sysadmin only uses a few specialized programs (tar
, mt
, etc.) with them, and it's all scripted. Nobody uses tapes as secondary storage these days.
Further, I use hard drives, a la Time Machine, as backups these days. They are far faster and more cost effective.
I don't think the unix concept of filesystems goes all the way to tape drives. Normally, tapedrives are accessed in a completely different manner (using special programs) than mountable media. Foundation will probably help you with mountable media, but not with tape drives that are anyway just used for backup. A little googleing on tape drives for mac turns up this: LTO4 Tape Archiving on the Mac - and it's from 2009. I haven't found any info about tape drives in snow leopard or lion. So really, I wonder how you would got about accessing one if you can't even test your code.
精彩评论